Pod 실행

  1. nginx Pod 생성

    kubectl run nginx \\
        --generator=run-pod/v1 \\
        --image=nginx \\
        --port=80
    
    pod/nginx created
    
  2. pod 확인

    kubectl get pods
    
    NAME    READY   STATUS    RESTARTS   AGE
    nginx   1/1     Running   0          45s
    
  3. replicaset 확인

    kubectl get replicasets
    
    No resources found.
    
  4. deployments 확인

    kubectl get deployments
    
    No resources found.
    
  5. pod 제거

    kubectl delete pod nginx
    
    pod "nginx" deleted
    

Deployment 생성

  1. nginx Deployment 생성

    kubectl run nginx \\
        --image=nginx \\
        --port=80
    
    deployment.apps/nginx created
    
  2. pod 확인

    kubectl get pods
    
    NAME                     READY   STATUS    RESTARTS   AGE
    nginx-57867cc648-bxqfz   1/1     Running   0          24s
    
  3. replicaset 확인

    kubectl get replicasets
    
    NAME               DESIRED   CURRENT   READY   AGE
    nginx-57867cc648   1         1         1       54s
    
  4. deployments 확인

    kubectl get deployments
    
    NAME    READY   UP-TO-DATE   AVAILABLE   AGE
    nginx   1/1     1            1           67s
    

현재 리소스 확인

  1. 노드 확인

    kubectl get nodes
    
  2. Pod 확인

    kubectl get pods
    
  3. Deployment 확인

    kubectl get deployments
    
  4. Service 확인

    kubectl get services
    

디버깅

  1. deployment 상세 정보 확인

    kubectl describe deployments nginx
    
    Name:                   nginx
    Namespace:              default
    CreationTimestamp:      Fri, 22 Feb 2019 13:52:43 +0000
    Labels:                 run=nginx
    Annotations:            deployment.kubernetes.io/revision: 1
    Selector:               run=nginx
    Replicas:               1 desired | 1 updated | 1 total | 1 available | 0 unavailable
    StrategyType:           RollingUpdate
    MinReadySeconds:        0
    RollingUpdateStrategy:  25% max unavailable, 25% max surge
    Pod Template:
      Labels:  run=nginx
      Containers:
       nginx:
        Image:        nginx
        Port:         80/TCP
        Host Port:    0/TCP
        Environment:  <none>
        Mounts:       <none>
      Volumes:        <none>
    Conditions:
      Type           Status  Reason
      ----           ------  ------
      Available      True    MinimumReplicasAvailable
      Progressing    True    NewReplicaSetAvailable
    OldReplicaSets:  <none>
    NewReplicaSet:   nginx-57867cc648 (1/1 replicas created)
    Events:
      Type    Reason             Age    From                   Message
      ----    ------             ----   ----                   -------
      Normal  ScalingReplicaSet  4m26s  deployment-controller  Scaled up replica set nginx-57867cc648 to 1