Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Info
iconfalse
Code Block
sansae@sansaeAir15m2 ~ % k apply -f nginx-deploy.yaml
deployment.apps/nginx-deploy created

sansae@sansaeAir15m2 ~ % k get all
NAME                               READY   STATUS    RESTARTS   AGE
pod/nginx-deploy-d4d6c7dd8-4zx7v   1/1     Running   0          3s
pod/nginx-deploy-d4d6c7dd8-m6p7j   1/1     Running   0          3s
pod/nginx-deploy-d4d6c7dd8-rm5hj   1/1     Running   0          3s

NAME                 TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)   AGE
service/kubernetes   ClusterIP   10.0.0.1     <none>        443/TCP   8h

NAME                           READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/nginx-deploy   3/3     3            3           3s

NAME                                     DESIRED   CURRENT   READY   AGE
replicaset.apps/nginx-deploy-d4d6c7dd8   3         3         3       3s
Code Block
sansae@sansaeAir15m2 ~ % k get pod
NAME                           READY   STATUS    RESTARTS   AGE
nginx-deploy-d4d6c7dd8-67vfc   1/1     Running   0          15s
nginx-deploy-d4d6c7dd8-d6zrj   1/1     Running   0          17s
nginx-deploy-d4d6c7dd8-zhq6g   1/1     Running   0          16s


sansae@sansaeAir15m2 ~ % k set image deploy/nginx-deploy nginx=nginx:1.15.12
deployment.apps/nginx-deploy image updated

sansae@sansaeAir15m2 k8s-lab-workspace % k rollout status deploy/nginx-deploy              
deployment "nginx-deploy" successfully rolled out

sansae@sansaeAir15m2 ~ % k describe deploy nginx-deploy
Name:                   nginx-deploy
Namespace:              default
CreationTimestamp:      Fri, 08 Mar 2024 23:17:39 +0900
Labels:                 app=myapp-deploy
                        type=front-end
Annotations:            deployment.kubernetes.io/revision: 2
Selector:               type=front-end
Replicas:               3 desired | 3 updated | 3 total | 3 available | 0 unavailable
StrategyType:           RollingUpdate
MinReadySeconds:        0
RollingUpdateStrategy:  25% max unavailable, 25% max surge
Pod Template:
  Labels:  app=myapp
           type=front-end
  Containers:
   nginx:
    Image:        nginx:1.15.12
    Port:         80/TCP
    Host Port:    0/TCP
    Environment:  <none>
    Mounts:       <none>
  Volumes:        <none>
Conditions:
  Type           Status  Reason
  ----           ------  ------
  Available      True    MinimumReplicasAvailable
  Progressing    True    NewReplicaSetAvailable
OldReplicaSets:  nginx-deploy-d4d6c7dd8 (0/0 replicas created)
NewReplicaSet:   nginx-deploy-77978cf89b (3/3 replicas created)
Events:
  Type    Reason             Age   From                   Message
  ----    ------             ----  ----                   -------
  Normal  ScalingReplicaSet  38s   deployment-controller  Scaled up replica set nginx-deploy-d4d6c7dd8 to 3
  Normal  ScalingReplicaSet  15s   deployment-controller  Scaled up replica set nginx-deploy-77978cf89b to 1
  Normal  ScalingReplicaSet  14s   deployment-controller  Scaled down replica set nginx-deploy-d4d6c7dd8 to 2 from 3
  Normal  ScalingReplicaSet  14s   deployment-controller  Scaled up replica set nginx-deploy-77978cf89b to 2 from 1
  Normal  ScalingReplicaSet  13s   deployment-controller  Scaled down replica set nginx-deploy-d4d6c7dd8 to 1 from 2
  Normal  ScalingReplicaSet  13s   deployment-controller  Scaled up replica set nginx-deploy-77978cf89b to 3 from 2
  Normal  ScalingReplicaSet  12s   deployment-controller  Scaled down replica set nginx-deploy-d4d6c7dd8 to 0 from 1


sansae@sansaeAir15m2 k8s-lab-workspace % k rollout history deploy/nginx-deploy              
deployment.apps/nginx-deploy 
REVISION  CHANGE-CAUSE
1         <none>
2         <none>

sansae@sansaeAir15m2 k8s-lab-workspace % k rollout undo deploy/nginx-deploy                 
deployment.apps/nginx-deploy rolled back
sansae@sansaeAir15m2 k8s-lab-workspace % k get pod
NAME                           READY   STATUS    RESTARTS      AGE
nginx-deploy-d4d6c7dd8-g6chm   1/1     Running   0             2s
nginx-deploy-d4d6c7dd8-hs9xx   1/1     Running   0             3s
nginx-deploy-d4d6c7dd8-vsgbf   1/1     Running   0             5s
util                           1/1     Running   2 (21m ago)   142m


Info
%실제
  • 실제 운영에서는 rollout기능을 사용하지 않고, CI/CD를 구축하여 Container Image버전을 컨트롤 하여 배포 합니다.