Getting the details of a ReplicaSet

After we create the ReplicaSet, the subcommands get and describe can help us to capture its information and the status of Pods. In the CLI of Kubernetes, we are able to use the abbreviation rs for resource type, instead of the full name ReplicaSet:

// use subcommand "get" to list all ReplicaSets
$ kubectl get rs
NAME DESIRED CURRENT READY AGE
my-first-replicaset 3 3 3 4s

This result shows roughly that the Pod replicas of my-first-replicaset are all running successfully; currently running Pods are of the desired number and all of them are ready for serving requests.

For detailed information, check by using the subcommand describe:

// specify that we want to check ReplicaSet called my-first-replicaset
$ kubectl describe rs my-first-replicaset
Name: my-first-replicaset
Namespace: default
Selector: project=My-Happy-Web,role=frontend
Labels: version=0.0.1
Annotations: <none>
Replicas: 3 current / 3 desired
Pods Status: 3 Running / 0 Waiting / 0 Succeeded / 0 Failed
Pod Template:
Labels: env=dev
project=My-Happy-Web
role=frontend
Containers:
happy-web:
Image: nginx:latest
Port: <none>
Host Port: <none>
Environment: <none>
Mounts: <none>
Volumes: <none>
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal SuccessfulCreate 9s replicaset-controller Created pod: my-first-replicaset-8hg55
Normal SuccessfulCreate 9s replicaset-controller Created pod: my-first-replicaset-wtphz
Normal SuccessfulCreate 9s replicaset-controller Created pod: my-first-replicaset-xcrws

You can see that the output lists ReplicaSet's particulars of the configuration, just like what we requested in the YAML file. Furthermore, the logs for the creation of Pods are shown as part of ReplicaSet, which confirms that the Pod replicas are successfully created and designated with unique names. You can also check Pods by name:

// get the description according the name of Pod, please look at the Pod name shown on your screen, which should be different from this book.
$ kubectl describe pod my-first-replicaset-xcrws
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.17.162.214