12 CHAPTER 2. KUBERNETES ARCHITECTURE
7. You can also view resources in all namespaces at once. Use the --all-namespaces options to select objects in all
namespaces at once.
student@ckad-1:~$ kubectl get pod --all-namespaces
NAMESPACE NAME READY STATUS RESTARTS AGE
default firstpod-6bb4574d94-rqk76 1/1 Running 0 5m
kube-system calico-etcd-z49kx 1/1 Running 0 31m
kube-system calico-kube-controllers-d554689d5-pfszw 1/1 Running 0 31m
<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.
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
student@ckad-1:~$ kubectl get deployment,rs,po,svc,ep
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/basicservice NodePort 10.108.147.76 <none> 80:31601/TCP 35m
LFD259: V 2019-01-14 © Copyright the Linux Foundation 2019. All rights reserved.