K3S學習紀錄 (一) - K8S部署nginx筆記


建立nginx-deployment.yaml

apiVersionapps/v1
kindDeployment
metadata:
  namenginx-deployment
  labels:
    appnginx
spec:
  replicas1
  selector:
    matchLabels:
      appnginx
  template:
    metadata:
      labels:
        appnginx
    spec:
      containers:
      - namenginx
        imagenginx:1.17.4
        ports:
        - containerPort80

建立資源

$> 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]








留言

熱門文章