K3S學習紀錄 (一) - K8S部署nginx筆記
建立nginx-deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
labels:
app: nginx
spec:
replicas: 1
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.17.4
ports:
- containerPort: 80
建立資源
$> kubectl create -f nginx-deployment.yaml
$> kubectl get pods
### Retrieve a lot more information of pods when pods has problem
$> kubectl describe pod
### Forward
$> kubectl port-forward nginx-deployment-b79bf7666-7mnjj 8080:80
### Update deployment
$> kubectl replace -f nginx-deployment.yaml
### Delete Pods
$> kubectl delete pods [pod name]
留言