brunch

You can make anything
by writing

C.S.Lewis

by Master Seo Feb 21. 2023

7. 오라클 클라우드 - 쿠버네티스 - 리플리카세트

<1> 컨트롤러?

<2> ReplicaSet ?

<3> 리플리카셋 실습

<4> 죽지 않는 pod - 리플리카셋이 관리하고 있음

<5> 디플로이 먼트 실습

<6> 롤링 업데이트와 롤백



<1> 컨트롤러?


모니터링하며, 원하는 상태가 되도록 만들어 주는것이 컨트롤러 이다.



<2> ReplicaSet ?


1

Pod의 수를 일정 갯수로 유지 되도록 해주는것

아래 예제에서 3개의 Pod를 유지해보자~



2

topasvga@cloudshell:~ (ap-seoul-1)$ cat << EOF > replicaset-cndk.yaml

> apiVersion: apps/v1

> kind: ReplicaSet

> metadata:

>   name: replicaset-cndk

> spec:

>   replicas: 3

>   selector:

>     matchLabels:

>       app: cndk-nginx-pods

>   template:

>     metadata:

>       name: cndk-nginx-pod

>       labels:

>         app: cndk-nginx-pods

>     spec:

>       containers:

>       - name: nginx

>         image: nginx:latest

> EOF




3

topasvga@cloudshell:~ (ap-seoul-1)$ kubectl apply -f replicaset-cndk.yaml

replicaset.apps/replicaset-cndk created


4

topasvga@cloudshell:~ (ap-seoul-1)$ kubectl get pods,rs,deploy -o wide

NAME                        READY   STATUS    RESTARTS   AGE   IP             NODE          NOMINATED NODE   READINESS GATES

pod/replicaset-cndk-24zqg   1/1     Running   0          24s   10.244.0.30    10.0.10.80    <none>           <none>

pod/replicaset-cndk-hn8x5   1/1     Running   0          24s   10.244.0.31    10.0.10.80    <none>           <none>

pod/replicaset-cndk-s47mh   1/1     Running   0          24s   10.244.0.141   10.0.10.141   <none>           <none>

NAME                              DESIRED   CURRENT   READY   AGE   CONTAINERS   IMAGES         SELECTOR

replicaset.apps/replicaset-cndk   3         3         3       24s   nginx        nginx:latest   app=cndk-nginx-pods


5

topasvga@cloudshell:~ (ap-seoul-1)$ kubectl describe replicasets.apps replicaset-cndk

Name:         replicaset-cndk

Namespace:    default

Selector:     app=cndk-nginx-pods

Labels:       <none>

Annotations:  <none>

Replicas:     3 current / 3 desired

Pods Status:  3 Running / 0 Waiting / 0 Succeeded / 0 Failed

Pod Template:

  Labels:  app=cndk-nginx-pods

  Containers:

   nginx:

    Image:        nginx:latest

    Port:         <none>

    Host Port:    <none>

    Environment:  <none>

    Mounts:       <none>

  Volumes:        <none>

Events:

  Type    Reason            Age   From                   Message

  ----    ------            ----  ----                   -------

  Normal  SuccessfulCreate  84s   replicaset-controller  Created pod: replicaset-cndk-hn8x5

  Normal  SuccessfulCreate  84s   replicaset-controller  Created pod: replicaset-cndk-s47mh

  Normal  SuccessfulCreate  84s   replicaset-controller  Created pod: replicaset-cndk-24zqg


6

topasvga@cloudshell:~ (ap-seoul-1)$ kubectl get pod --show-labels

NAME                    READY   STATUS    RESTARTS   AGE    LABELS

replicaset-cndk-24zqg   1/1     Running   0          111s   app=cndk-nginx-pods

replicaset-cndk-hn8x5   1/1     Running   0          111s   app=cndk-nginx-pods

replicaset-cndk-s47mh   1/1     Running   0          111s   app=cndk-nginx-pods


7

topasvga@cloudshell:~ (ap-seoul-1)$ kubectl edit replicasets.apps replicaset-cndk

replicaset.apps/replicaset-cndk edited


spec:

  replicas: 6


8

topasvga@cloudshell:~ (ap-seoul-1)$ kubectl get pods

NAME                    READY   STATUS    RESTARTS   AGE

replicaset-cndk-24zqg   1/1     Running   0          2m42s

replicaset-cndk-hn8x5   1/1     Running   0          2m42s

replicaset-cndk-qlv2k   1/1     Running   0          14s

replicaset-cndk-s47mh   1/1     Running   0          2m42s

replicaset-cndk-wg6bm   1/1     Running   0          14s

replicaset-cndk-xjw77   1/1     Running   0          14s


9

topasvga@cloudshell:~ (ap-seoul-1)$ kubectl delete replicasets.apps replicaset-cndk

replicaset.apps "replicaset-cndk" deleted




<3> 리플리카셋 실습


1

topasvga@cloudshell:~ (ap-seoul-1)$ kubectl apply -f replicaset-cndk.yaml

replicaset.apps/replicaset-cndk created



2

topasvga@cloudshell:~ (ap-seoul-1)$ kubectl get rs,deploy

NAME                              DESIRED   CURRENT   READY   AGE

replicaset.apps/replicaset-cndk   3         3         3       17s


3

topasvga@cloudshell:~ (ap-seoul-1)$ kubectl get replicasets.apps -o wide

NAME              DESIRED   CURRENT   READY   AGE   CONTAINERS   IMAGES         SELECTOR

replicaset-cndk   3         3         3       93s   nginx        nginx:latest   app=cndk-nginx-pods


4

topasvga@cloudshell:~ (ap-seoul-1)$ kubectl get pods

NAME                    READY   STATUS    RESTARTS   AGE

replicaset-cndk-9tflm   1/1     Running   0          2m18s

replicaset-cndk-c2bk4   1/1     Running   0          2m18s

replicaset-cndk-pw85g   1/1     Running   0          2m18s



5

중복되는 Label의  Pod 생성하면 ?

생성되자 마자 죽는다!!


topasvga@cloudshell:~ (ap-seoul-1)$ cat << EOF > pod-rs.yaml

> apiVersion: v1

> kind: Pod

> metadata:

>   name: pod1

>   labels:

>     app: cndk-nginx-pods

> spec:

>   containers:

>   - name: hello1

>     image: gcr.io/google-samples/hello-app:1.0

> ---

> apiVersion: v1

> kind: Pod

> metadata:

>   name: pod2

>   labels:

>     app: cndk-nginx-pods

> spec:

>   containers:

>   - name: hello2

>     image: gcr.io/google-samples/hello-app:2.0

> EOF


6

topasvga@cloudshell:~ (ap-seoul-1)$ kubectl apply -f pod-rs.yaml && kubectl get pod -w

pod/pod1 created

pod/pod2 created

NAME                    READY   STATUS        RESTARTS   AGE

pod1                    0/1     Terminating   0          2s

pod2                    0/1     Terminating   0          2s

replicaset-cndk-9tflm   1/1     Running       0          2m59s

replicaset-cndk-c2bk4   1/1     Running       0          2m59s

replicaset-cndk-pw85g   1/1     Running       0          2m59s

pod1                    1/1     Terminating   0          5s

pod2                    1/1     Terminating   0          5s

pod1                    0/1     Terminating   0          6s

pod1                    0/1     Terminating   0          6s

pod1                    0/1     Terminating   0          6s

pod2                    0/1     Terminating   0          6s

pod2                    0/1     Terminating   0          6s

pod2                    0/1     Terminating   0          6s




<4> 죽지 않는 pod - 리플리카셋이 관리하고 있음


1

topasvga@cloudshell:~ (ap-seoul-1)kubectl get pods

NAME                    READY   STATUS    RESTARTS   AGE

replicaset-cndk-9tflm   1/1     Running   0          3m41s

replicaset-cndk-c2bk4   1/1     Running   0          3m41s

replicaset-cndk-pw85g   1/1     Running   0          3m41s


2

pod 삭제한다.


topasvga@cloudshell:~ (ap-seoul-1)$ kubectl delete pod -l app=cndk-nginx-pods

pod "replicaset-cndk-9tflm" deleted

pod "replicaset-cndk-c2bk4" deleted

pod "replicaset-cndk-pw85g" deleted


3

새로 3개 자동 생성 된다.

topasvga@cloudshell:~ (ap-seoul-1)$ kubectl get pod -w

NAME                    READY   STATUS    RESTARTS   AGE

replicaset-cndk-9w8cj   1/1     Running   0          7s

replicaset-cndk-pghzz   1/1     Running   0          7s

replicaset-cndk-tvjf8   1/1     Running   0          6s



4

라벨 확인

topasvga@cloudshell:~ (ap-seoul-1)$ kubectl get pod --show-labels

NAME                    READY   STATUS    RESTARTS   AGE   LABELS

replicaset-cndk-9w8cj   1/1     Running   0          37s   app=cndk-nginx-pods

replicaset-cndk-pghzz   1/1     Running   0          37s   app=cndk-nginx-pods

replicaset-cndk-tvjf8   1/1     Running   0          36s   app=cndk-nginx-pods


5

topasvga@cloudshell:~ (ap-seoul-1)$ kubectl label pod  replicaset-cndk-9w8cj app-

pod/replicaset-cndk-9w8cj unlabeled


6

topasvga@cloudshell:~ (ap-seoul-1)$ kubectl get pod --show-labels

NAME                    READY   STATUS    RESTARTS   AGE    LABELS

replicaset-cndk-62x24   1/1     Running   0          8s     app=cndk-nginx-pods

replicaset-cndk-9w8cj   1/1     Running   0          116s   <none>

replicaset-cndk-pghzz   1/1     Running   0          116s   app=cndk-nginx-pods

replicaset-cndk-tvjf8   1/1     Running   0          115s   app=cndk-nginx-pods



7

topasvga@cloudshell:~ (ap-seoul-1)$ kubectl delete rs replicaset-cndk

replicaset.apps "replicaset-cndk" deleted



8

라벨 지워져 없는것은 안지워 진다.

topasvga@cloudshell:~ (ap-seoul-1)$ kubectl get pod --show-labels

NAME                    READY   STATUS    RESTARTS   AGE     LABELS

replicaset-cndk-9w8cj   1/1     Running   0          2m28s   <none>


9

파드 삭제하기

topasvga@cloudshell:~ (ap-seoul-1)$ kubectl delete pod --all

pod "replicaset-cndk-9w8cj" deleted





<5> 디플로이 먼트 실습


1

topasvga@cloudshell:~ (ap-seoul-1)$ cat << EOF > deployment-cndk.yaml

> apiVersion: apps/v1

> kind: Deployment

> metadata:

>   name: deployment-cndk

> spec:

>   replicas: 3

>   selector:

>     matchLabels:

>       app: cndk-nginx-pods

>   template:

>     metadata:

>       name: cndk-nginx-pod

>       labels:

>         app: cndk-nginx-pods

>     spec:

>       containers:

>       - name: nginx

>         image: nginx:latest

> EOF



2

topasvga@cloudshell:~ (ap-seoul-1)$ kubectl apply -f deployment-cndk.yaml

deployment.apps/deployment-cndk created


3

topasvga@cloudshell:~ (ap-seoul-1)$ kubectl get deploy,rs,pods

NAME                              READY   UP-TO-DATE   AVAILABLE   AGE

deployment.apps/deployment-cndk   3/3     3            3           12s


NAME                                         DESIRED   CURRENT   READY   AGE

replicaset.apps/deployment-cndk-76bc4fd57f   3         3         3       12s


NAME                                   READY   STATUS    RESTARTS   AGE

pod/deployment-cndk-76bc4fd57f-h5m4c   1/1     Running   0          13s

pod/deployment-cndk-76bc4fd57f-st7c6   1/1     Running   0          13s

pod/deployment-cndk-76bc4fd57f-tlhbx   1/1     Running   0          13s



4

topasvga@cloudshell:~ (ap-seoul-1)$ kubectl get deployments.apps -o wide

NAME              READY   UP-TO-DATE   AVAILABLE   AGE     CONTAINERS   IMAGES         SELECTOR

deployment-cndk   3/3     3            3           2m26s   nginx        nginx:latest   app=cndk-nginx-pods

topasvga@cloudshell:~ (ap-seoul-1)$ 

topasvga@cloudshell:~ (ap-seoul-1)$ kubectl get replicasets.apps -o wide

NAME                         DESIRED   CURRENT   READY   AGE     CONTAINERS   IMAGES         SELECTOR

deployment-cndk-76bc4fd57f   3         3         3       2m42s   nginx        nginx:latest   app=cndk-nginx-pods,pod-template-hash=76bc4fd57f



5

topasvga@cloudshell:~ (ap-seoul-1)$ kubectl get pod --show-labels

NAME                               READY   STATUS    RESTARTS   AGE    LABELS

deployment-cndk-76bc4fd57f-h5m4c   1/1     Running   0          3m3s   app=cndk-nginx-pods,pod-template-hash=76bc4fd57f

deployment-cndk-76bc4fd57f-st7c6   1/1     Running   0          3m3s   app=cndk-nginx-pods,pod-template-hash=76bc4fd57f

deployment-cndk-76bc4fd57f-tlhbx   1/1     Running   0          3m3s   app=cndk-nginx-pods,pod-template-hash=76bc4fd57f



8

topasvga@cloudshell:~ (ap-seoul-1)$ kubectl scale deployment --replicas=6 deployment-cndk

deployment.apps/deployment-cndk scaled



9

topasvga@cloudshell:~ (ap-seoul-1)$ kubectl get pod --show-labels

NAME                               READY   STATUS    RESTARTS   AGE     LABELS

deployment-cndk-76bc4fd57f-9n7fs   1/1     Running   0          38s     app=cndk-nginx-pods,pod-template-hash=76bc4fd57f

deployment-cndk-76bc4fd57f-h5m4c   1/1     Running   0          3m55s   app=cndk-nginx-pods,pod-template-hash=76bc4fd57f

deployment-cndk-76bc4fd57f-mw87z   1/1     Running   0          38s     app=cndk-nginx-pods,pod-template-hash=76bc4fd57f

deployment-cndk-76bc4fd57f-st7c6   1/1     Running   0          3m55s   app=cndk-nginx-pods,pod-template-hash=76bc4fd57f

deployment-cndk-76bc4fd57f-tgn88   1/1     Running   0          38s     app=cndk-nginx-pods,pod-template-hash=76bc4fd57f

deployment-cndk-76bc4fd57f-tlhbx   1/1     Running   0          3m55s   app=cndk-nginx-pods,pod-template-hash=76bc4fd57f



10

pod 삭제 

topasvga@cloudshell:~ (ap-seoul-1)$ kubectl delete pod --all

pod "deployment-cndk-76bc4fd57f-9n7fs" deleted

pod "deployment-cndk-76bc4fd57f-h5m4c" deleted

pod "deployment-cndk-76bc4fd57f-mw87z" deleted

pod "deployment-cndk-76bc4fd57f-st7c6" deleted

pod "deployment-cndk-76bc4fd57f-tgn88" deleted

pod "deployment-cndk-76bc4fd57f-tlhbx" deleted



다시 자동 생성된다

topasvga@cloudshell:~ (ap-seoul-1)$ kubectl get pod 

NAME                               READY   STATUS    RESTARTS   AGE

deployment-cndk-76bc4fd57f-4tqtx   1/1     Running   0          19s

deployment-cndk-76bc4fd57f-8nmzb   1/1     Running   0          18s

deployment-cndk-76bc4fd57f-hrk5s   1/1     Running   0          19s

deployment-cndk-76bc4fd57f-mwt8q   1/1     Running   0          19s

deployment-cndk-76bc4fd57f-nnmsx   1/1     Running   0          19s

deployment-cndk-76bc4fd57f-w5ftv   1/1     Running   0          19s



11

리플리카 삭제 

다시 살아 난다.

topasvga@cloudshell:~ (ap-seoul-1)$ kubectl delete replicasets.apps --all

replicaset.apps "deployment-cndk-76bc4fd57f" deleted



topasvga@cloudshell:~ (ap-seoul-1)$ kubectl get deploy,rs,pod

NAME                              READY   UP-TO-DATE   AVAILABLE   AGE

deployment.apps/deployment-cndk   6/6     6            6           5m20s


NAME                                         DESIRED   CURRENT   READY   AGE

replicaset.apps/deployment-cndk-76bc4fd57f   6         6         6       25s


NAME                                   READY   STATUS    RESTARTS   AGE

pod/deployment-cndk-76bc4fd57f-6c8xz   1/1     Running   0          24s

pod/deployment-cndk-76bc4fd57f-c7n6f   1/1     Running   0          25s

pod/deployment-cndk-76bc4fd57f-lv524   1/1     Running   0          24s

pod/deployment-cndk-76bc4fd57f-pz5md   1/1     Running   0          24s

pod/deployment-cndk-76bc4fd57f-vv4hn   1/1     Running   0          24s

pod/deployment-cndk-76bc4fd57f-zdz2d   1/1     Running   0          24s



12

디플로이먼트 삭제

디플로이먼트를 삭제하면 모두 삭제 된다.

topasvga@cloudshell:~ (ap-seoul-1)$ kubectl delete deployments.apps deployment-cndk

deployment.apps "deployment-cndk" deleted



13

확인

모두 삭제 되었다.

topasvga@cloudshell:~ (ap-seoul-1)$ kubectl get deploy,rs,pod

No resources found in default namespace.





<6> 롤링 업데이트와 롤백



1

topasvga@cloudshell:~ (ap-seoul-1)$ cat << EOF > deployment-nginx-1.yaml

> apiVersion: apps/v1

> kind: Deployment

> metadata:

>   name: deployment-nginx

> spec:

>   replicas: 3

>   selector:

>     matchLabels:

>       app: cndk-nginx-pods

>   template:

>     metadata:

>       name: cndk-nginx-pod

>       labels:

>         app: cndk-nginx-pods

>     spec:

>       containers:

>       - name: nginx

>         image: nginx:1.11

> EOF


2

topasvga@cloudshell:~ (ap-seoul-1)$ kubectl apply -f deployment-nginx-1.yaml --record

Flag --record has been deprecated, --record will be removed in the future

deployment.apps/deployment-nginx created


3

topasvga@cloudshell:~ (ap-seoul-1)$ kubectl get pod -o yaml | grep "image: nginx"

    - image: nginx:1.11

    - image: nginx:1.11

    - image: nginx:1.11


4

topasvga@cloudshell:~ (ap-seoul-1)$ kubectl rollout history deployment deployment-nginx

deployment.apps/deployment-nginx 

REVISION  CHANGE-CAUSE

1         kubectl apply --filename=deployment-nginx-1.yaml --record=true


5

topasvga@cloudshell:~ (ap-seoul-1)$ kubectl set image deployment deployment-nginx nginx=nginx:1.12 --record && kubectl get pod -w

Flag --record has been deprecated, --record will be removed in the future

deployment.apps/deployment-nginx image updated

NAME                                READY   STATUS              RESTARTS   AGE

deployment-nginx-558dfc6f84-4zrgr   0/1     ContainerCreating   0          2s

deployment-nginx-775869fd7-257pb    1/1     Running             0          46s

deployment-nginx-775869fd7-jc8wm    1/1     Running             0          46s

deployment-nginx-775869fd7-ndtz4    1/1     Running             0          46s

deployment-nginx-558dfc6f84-4zrgr   1/1     Running             0          10s

deployment-nginx-775869fd7-ndtz4    1/1     Terminating         0          54s

deployment-nginx-558dfc6f84-spqvn   0/1     Pending             0          0s

deployment-nginx-558dfc6f84-spqvn   0/1     Pending             0          0s

deployment-nginx-558dfc6f84-spqvn   0/1     ContainerCreating   0          0s

deployment-nginx-775869fd7-ndtz4    0/1     Terminating         0          56s

deployment-nginx-775869fd7-ndtz4    0/1     Terminating         0          56s

deployment-nginx-775869fd7-ndtz4    0/1     Terminating         0          56s

deployment-nginx-558dfc6f84-spqvn   1/1     Running             0          11s

deployment-nginx-775869fd7-jc8wm    1/1     Terminating         0          65s

deployment-nginx-558dfc6f84-sjxn8   0/1     Pending             0          0s

deployment-nginx-558dfc6f84-sjxn8   0/1     Pending             0          0s

deployment-nginx-558dfc6f84-sjxn8   0/1     ContainerCreating   0          0s

deployment-nginx-558dfc6f84-sjxn8   1/1     Running             0          2s

deployment-nginx-775869fd7-257pb    1/1     Terminating         0          67s

deployment-nginx-775869fd7-jc8wm    0/1     Terminating         0          67s

deployment-nginx-775869fd7-jc8wm    0/1     Terminating         0          67s

deployment-nginx-775869fd7-jc8wm    0/1     Terminating         0          67s

deployment-nginx-775869fd7-257pb    0/1     Terminating         0          68s

deployment-nginx-775869fd7-257pb    0/1     Terminating         0          68s

deployment-nginx-775869fd7-257pb    0/1     Terminating         0          68s


6

topasvga@cloudshell:~ (ap-seoul-1)$ kubectl get pod -o yaml | grep "image: nginx"

    - image: nginx:1.12

    - image: nginx:1.12

    - image: nginx:1.12



7

topasvga@cloudshell:~ (ap-seoul-1)$ kubectl set image deployment deployment-nginx nginx=nginx:1.13 --record && kubectl get pod -w

Flag --record has been deprecated, --record will be removed in the future

deployment.apps/deployment-nginx image updated

NAME                                READY   STATUS              RESTARTS   AGE

deployment-nginx-558dfc6f84-4zrgr   1/1     Running             0          60s

deployment-nginx-558dfc6f84-sjxn8   1/1     Running             0          39s

deployment-nginx-558dfc6f84-spqvn   1/1     Running             0          50s

deployment-nginx-c9cc67877-hlns2    0/1     ContainerCreating   0          3s

deployment-nginx-c9cc67877-hlns2    1/1     Running             0          9s

deployment-nginx-558dfc6f84-spqvn   1/1     Terminating         0          56s

deployment-nginx-c9cc67877-ft6t7    0/1     Pending             0          0s

deployment-nginx-c9cc67877-ft6t7    0/1     Pending             0          0s

deployment-nginx-c9cc67877-ft6t7    0/1     ContainerCreating   0          0s

deployment-nginx-558dfc6f84-spqvn   0/1     Terminating         0          57s

deployment-nginx-558dfc6f84-spqvn   0/1     Terminating         0          57s

deployment-nginx-558dfc6f84-spqvn   0/1     Terminating         0          57s

deployment-nginx-c9cc67877-ft6t7    1/1     Running             0          10s

deployment-nginx-558dfc6f84-sjxn8   1/1     Terminating         0          55s

deployment-nginx-c9cc67877-r2whn    0/1     Pending             0          0s

deployment-nginx-c9cc67877-r2whn    0/1     Pending             0          0s

deployment-nginx-c9cc67877-r2whn    0/1     ContainerCreating   0          0s

deployment-nginx-558dfc6f84-sjxn8   0/1     Terminating         0          56s

deployment-nginx-c9cc67877-r2whn    1/1     Running             0          1s

deployment-nginx-558dfc6f84-4zrgr   1/1     Terminating         0          77s

deployment-nginx-558dfc6f84-sjxn8   0/1     Terminating         0          57s

deployment-nginx-558dfc6f84-sjxn8   0/1     Terminating         0          57s

deployment-nginx-558dfc6f84-4zrgr   0/1     Terminating         0          78s

deployment-nginx-558dfc6f84-4zrgr   0/1     Terminating         0          78s

deployment-nginx-558dfc6f84-4zrgr   0/1     Terminating         0          78s



8

topasvga@cloudshell:~ (ap-seoul-1)$ kubectl get pod -o yaml | grep "image: nginx"

    - image: nginx:1.13

    - image: nginx:1.13

    - image: nginx:1.13



9

topasvga@cloudshell:~ (ap-seoul-1)$ kubectl rollout history deployment deployment-nginx

deployment.apps/deployment-nginx 

REVISION  CHANGE-CAUSE

1         kubectl apply --filename=deployment-nginx-1.yaml --record=true

2         kubectl set image deployment deployment-nginx nginx=nginx:1.12 --record=true

3         kubectl set image deployment deployment-nginx nginx=nginx:1.13 --record=true



10

2번으로 롤백


topasvga@cloudshell:~ (ap-seoul-1)$ kubectl rollout undo deployment deployment-nginx --to-revision=2

deployment.apps/deployment-nginx rolled back

topasvga@cloudshell:~ (ap-seoul-1)$ kubectl get pod -o yaml | grep "image: nginx"

    - image: nginx:1.12

    - image: nginx:1.12

    - image: nginx:1.12



11

topasvga@cloudshell:~ (ap-seoul-1)$  kubectl get replicasets.apps --show-labels

NAME                          DESIRED   CURRENT   READY   AGE     LABELS

deployment-nginx-558dfc6f84   3         3         3       2m41s   app=cndk-nginx-pods,pod-template-hash=558dfc6f84

deployment-nginx-775869fd7    0         0         0       3m25s   app=cndk-nginx-pods,pod-template-hash=775869fd7

deployment-nginx-c9cc67877    0         0         0       104s    app=cndk-nginx-pods,pod-template-hash=c9cc67877



                    12

topasvga@cloudshell:~ (ap-seoul-1)$ kubectl get pods,rs,deploy -o wide

NAME                                    READY   STATUS    RESTARTS   AGE   IP             NODE          NOMINATED NODE   READINESS GATES

pod/deployment-nginx-558dfc6f84-8cht4   1/1     Running   0          56s   10.244.0.53    10.0.10.80    <none>           <none>

pod/deployment-nginx-558dfc6f84-tmrzg   1/1     Running   0          59s   10.244.0.161   10.0.10.141   <none>           <none>

pod/deployment-nginx-558dfc6f84-zjz99   1/1     Running   0          58s   10.244.0.52    10.0.10.80    <none>           <none>


NAME                                          DESIRED   CURRENT   READY   AGE     CONTAINERS   IMAGES       SELECTOR

replicaset.apps/deployment-nginx-558dfc6f84   3         3         3       3m23s   nginx        nginx:1.12   app=cndk-nginx-pods,pod-template-hash=558dfc6f84

replicaset.apps/deployment-nginx-775869fd7    0         0         0       4m7s    nginx        nginx:1.11   app=cndk-nginx-pods,pod-template-hash=775869fd7

replicaset.apps/deployment-nginx-c9cc67877    0         0         0       2m26s   nginx        nginx:1.13   app=cndk-nginx-pods,pod-template-hash=c9cc67877


NAME                               READY   UP-TO-DATE   AVAILABLE   AGE    CONTAINERS   IMAGES       SELECTOR

deployment.apps/deployment-nginx   3/3     3            3           4m7s   nginx        nginx:1.12   app=cndk-nginx-pods



13

deployments.apps  삭제해야 지워 진다.

topasvga@cloudshell:~ (ap-seoul-1)$ kubectl delete deployments.apps --all

deployment.apps "deployment-nginx" deleted



감사합니다.

매거진의 이전글 6. 오라클 클라우드 - 쿠버네티스 -컨피그맵 환경변수
브런치는 최신 브라우저에 최적화 되어있습니다. IE chrome safari