13
student@ckad-1:~$ kubectl get pod --all-namespaces
NAMESPACE NAME READY STATUS RESTARTS AGE
default firstpod-69cfdfd8d9-kj6ql 1/1 Running 0 44m
kube-system calico-node-5ftrr 2/2 Running 0 92m
kube-system calico-node-f7zrw 2/2 Running 0 89m
kube-system coredns-fb8b8dccf-cmkds 1/1 Running 0 92m
<output_omitted>
8. View several resources at once. Note that most resources have a short name such as rs for ReplicaSet, po for Pod,
svc for Service, and ep for endpoint. Note the endpoint still exists after we deleted the pod.
student@ckad-1:~$ kubectl get deploy,rs,po,svc,ep
NAME READY UP-TO-DATE AVAILABLE AGE
deployment.extensions/firstpod 1/1 1 1 4m
NAME DESIRED CURRENT READY....
replicaset.extensions/firstpod-6bb4574d94-rqk76 1 1 1 ....
NAME READY STATUS RESTARTS AGE
pod/firstpod-6bb4574d94-rqk76 1/1 Running 0 4m
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/basicservice NodePort 10.108.147.76 <none> 80:31601/TCP 21m
service/kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 21m
NAME ENDPOINTS AGE
endpoints/basicservice <none> 21m
endpoints/kubernetes 10.128.0.3:6443 21m
9. Delete the ReplicaSet and view the resources again. Note that the age on the ReplicaSet and the pod it controls is
now less than a minute. The deployment controller started a new ReplicaSet when we deleted the existing one, which
started another pod when the desired configuration did not match the current status.
student@ckad-1:~$ kubectl delete rs firstpod-6bb4574d94-rqk76
replicaset.extensions "firstpod-6bb4574d94-rqk76" deleted
student@ckad-1:~$ kubectl get deployment,rs,po,svc,ep
NAME READY UP-TO-DATE AVAILABLE AGE
deployment.extensions/firstpod 1/1 1 1 7m
NAME DESIRED CURRENT....
replicaset.extensions/firstpod-6bb4574d94-rqk76 1 1 ....
NAME READY STATUS RESTARTS AGE
pod/firstpod-7d99ffc75-p9hbw 1/1 Running 0 12s
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 24m
NAME ENDPOINTS AGE
endpoints/kubernetes 10.128.0.2:6443 80m
endpoints/basicservice <none> 21m
10. This time delete the top-level controller. After about 30 seconds for everything to shut down you should only see the
cluster service and endpoint remain for the cluster and the service we created.
student@ckad-1:~$ kubectl delete deployment firstpod
deployment.extensions "firstpod" deleted
LFD259: V 2019-05-16 © Copyright the Linux Foundation 2019. All rights reserved.