Update output of creating replicaset in controllers/replicaset (#19088)

pull/19213/head
Kohei Toyoda 2020-02-20 21:37:04 +09:00 committed by GitHub
parent f24680eab5
commit 21cbf8ea91
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 40 additions and 42 deletions

View File

@ -75,53 +75,50 @@ kubectl describe rs/frontend
And you will see output similar to: And you will see output similar to:
```shell ```shell
Name: frontend Name: frontend
Namespace: default Namespace: default
Selector: tier=frontend Selector: tier=frontend
Labels: app=guestbook Labels: app=guestbook
tier=frontend tier=frontend
Annotations: <none> Annotations: kubectl.kubernetes.io/last-applied-configuration:
Replicas: 3 current / 3 desired {"apiVersion":"apps/v1","kind":"ReplicaSet","metadata":{"annotations":{},"labels":{"app":"guestbook","tier":"frontend"},"name":"frontend",...
Pods Status: 3 Running / 0 Waiting / 0 Succeeded / 0 Failed Replicas: 3 current / 3 desired
Pods Status: 3 Running / 0 Waiting / 0 Succeeded / 0 Failed
Pod Template: Pod Template:
Labels: app=guestbook Labels: tier=frontend
tier=frontend
Containers: Containers:
php-redis: php-redis:
Image: gcr.io/google_samples/gb-frontend:v3 Image: gcr.io/google_samples/gb-frontend:v3
Port: 80/TCP Port: <none>
Requests: Host Port: <none>
cpu: 100m Environment: <none>
memory: 100Mi Mounts: <none>
Environment: Volumes: <none>
GET_HOSTS_FROM: dns
Mounts: <none>
Volumes: <none>
Events: Events:
FirstSeen LastSeen Count From SubobjectPath Type Reason Message Type Reason Age From Message
--------- -------- ----- ---- ------------- -------- ------ ------- ---- ------ ---- ---- -------
1m 1m 1 {replicaset-controller } Normal SuccessfulCreate Created pod: frontend-qhloh Normal SuccessfulCreate 117s replicaset-controller Created pod: frontend-wtsmm
1m 1m 1 {replicaset-controller } Normal SuccessfulCreate Created pod: frontend-dnjpy Normal SuccessfulCreate 116s replicaset-controller Created pod: frontend-b2zdv
1m 1m 1 {replicaset-controller } Normal SuccessfulCreate Created pod: frontend-9si5l Normal SuccessfulCreate 116s replicaset-controller Created pod: frontend-vcmts
``` ```
And lastly you can check for the Pods brought up: And lastly you can check for the Pods brought up:
```shell ```shell
kubectl get Pods kubectl get pods
``` ```
You should see Pod information similar to: You should see Pod information similar to:
```shell ```shell
NAME READY STATUS RESTARTS AGE NAME READY STATUS RESTARTS AGE
frontend-9si5l 1/1 Running 0 1m frontend-b2zdv 1/1 Running 0 6m36s
frontend-dnjpy 1/1 Running 0 1m frontend-vcmts 1/1 Running 0 6m36s
frontend-qhloh 1/1 Running 0 1m frontend-wtsmm 1/1 Running 0 6m36s
``` ```
You can also verify that the owner reference of these pods is set to the frontend ReplicaSet. You can also verify that the owner reference of these pods is set to the frontend ReplicaSet.
To do this, get the yaml of one of the Pods running: To do this, get the yaml of one of the Pods running:
```shell ```shell
kubectl get pods frontend-9si5l -o yaml kubectl get pods frontend-b2zdv -o yaml
``` ```
The output will look similar to this, with the frontend ReplicaSet's info set in the metadata's ownerReferences field: The output will look similar to this, with the frontend ReplicaSet's info set in the metadata's ownerReferences field:
@ -129,11 +126,11 @@ The output will look similar to this, with the frontend ReplicaSet's info set in
apiVersion: v1 apiVersion: v1
kind: Pod kind: Pod
metadata: metadata:
creationTimestamp: 2019-01-31T17:20:41Z creationTimestamp: "2020-02-12T07:06:16Z"
generateName: frontend- generateName: frontend-
labels: labels:
tier: frontend tier: frontend
name: frontend-9si5l name: frontend-b2zdv
namespace: default namespace: default
ownerReferences: ownerReferences:
- apiVersion: apps/v1 - apiVersion: apps/v1
@ -141,7 +138,7 @@ metadata:
controller: true controller: true
kind: ReplicaSet kind: ReplicaSet
name: frontend name: frontend
uid: 892a2330-257c-11e9-aecd-025000000001 uid: f391f6db-bb9b-4c09-ae74-6a1f77f3d5cf
... ...
``` ```
@ -170,16 +167,17 @@ its desired count.
Fetching the Pods: Fetching the Pods:
```shell ```shell
kubectl get Pods kubectl get pods
``` ```
The output shows that the new Pods are either already terminated, or in the process of being terminated: The output shows that the new Pods are either already terminated, or in the process of being terminated:
```shell ```shell
NAME READY STATUS RESTARTS AGE NAME READY STATUS RESTARTS AGE
frontend-9si5l 1/1 Running 0 1m frontend-b2zdv 1/1 Running 0 10m
frontend-dnjpy 1/1 Running 0 1m frontend-vcmts 1/1 Running 0 10m
frontend-qhloh 1/1 Running 0 1m frontend-wtsmm 1/1 Running 0 10m
pod2 0/1 Terminating 0 4s pod1 0/1 Terminating 0 1s
pod2 0/1 Terminating 0 1s
``` ```
If you create the Pods first: If you create the Pods first:
@ -195,15 +193,15 @@ kubectl apply -f https://kubernetes.io/examples/controllers/frontend.yaml
You shall see that the ReplicaSet has acquired the Pods and has only created new ones according to its spec until the You shall see that the ReplicaSet has acquired the Pods and has only created new ones according to its spec until the
number of its new Pods and the original matches its desired count. As fetching the Pods: number of its new Pods and the original matches its desired count. As fetching the Pods:
```shell ```shell
kubectl get Pods kubectl get pods
``` ```
Will reveal in its output: Will reveal in its output:
```shell ```shell
NAME READY STATUS RESTARTS AGE NAME READY STATUS RESTARTS AGE
frontend-pxj4r 1/1 Running 0 5s frontend-hmmj2 1/1 Running 0 9s
pod1 1/1 Running 0 13s pod1 1/1 Running 0 36s
pod2 1/1 Running 0 13s pod2 1/1 Running 0 36s
``` ```
In this manner, a ReplicaSet can own a non-homogenous set of Pods In this manner, a ReplicaSet can own a non-homogenous set of Pods