k8s CKA - degutos/wikis GitHub Wiki

K8s - CKA course

Cluster basic Information and configuration

Showing cluster information

$ kubectl cluster-info
Kubernetes master is running at https://10.240.0.9:6443
KubeDNS is running at https://10.240.0.9:6443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy

To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.

Showing client config configuration

$ kubectl config view
apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: DATA+OMITTED
    server: https://10.240.0.9:6443
  name: kubernetes
contexts:
- context:
    cluster: kubernetes
    user: kubernetes-admin
  name: kubernetes-admin@kubernetes
current-context: kubernetes-admin@kubernetes
kind: Config
preferences: {}
users:
- name: kubernetes-admin
  user:
    client-certificate-data: REDACTED
    client-key-data: REDACTED

NOTE: This configuration is the kept in ~/.kube/config

Configuring user variables

mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config

Note: this user should have sudo previlegies

Kubectl completion

Installing bash-completion

$ sudo apt-get install bash-completion -y

Configuring bash-completion for Kubectl

$ kubectl completion bash >> ~/.bashrc

Note: close your session and open a new one. You should have kubectl bash-completion enabled

Kube basic commands

Getting kubectl help

$ kubectl -h
kubectl controls the Kubernetes cluster manager.

 Find more information at: https://kubernetes.io/docs/reference/kubectl/overview/

Basic Commands (Beginner):
  create        Create a resource from a file or from stdin.
  expose        Take a replication controller, service, deployment or pod and expose it as a new Kubernetes Service
  run           Run a particular image on the cluster
  set           Set specific features on objects

Basic Commands (Intermediate):
  explain       Documentation of resources
  get           Display one or many resources
  edit          Edit a resource on the server
  delete        Delete resources by filenames, stdin, resources and names, or by resources and label selector

Showing system pods

kubectl get pods -n kube-system

Showing api resources

kubectl api-resources

Showing api versions

kubectl api-versions

Showing all nodes in the cluster

kubectl get nodes

Showing all pods in the cluster

kubectl get pods

Showing all pods with more information

kubectl get pods -o wide

Showing all resources in the cluster

kubectl get all

Showing all resources in the namespace of the System

kubectl get all -n kube-system

Showing all resources in all namespaces

kubectl get all --all-namespaces

How to disable memory swap. Disabling the swap line.

free -m
vi /etc/fstab

Installing git vim and bash-completion

apt-get install git vim bash-completion

Getting cluster info

kubectl cluster-info

How to enable kubectl bash completion

vi ~/.bashrc
source <(kubectl completion bash)

Kubernetes config file

vi /etc/kubernetes/admin.conf

and Also

vi .kube/config

Showing configurations

kubectl config -h
kubectl config get-contexts
kubectl config get clusters
kubectl config get-clusters
kubectl config current-context
kubectl config vew
kubectl config view
kubectl get all

Kubernetes API

Checking permissions

$ kubectl auth can-i create deployments
yes
$ kubectl auth can-i create deployment --as linda
no

$ kubectl auth can-i create deployment --namespace secret
yes

Checking API resources

$ kubectl api-resources
NAME                              SHORTNAMES   APIGROUP                       NAMESPACED   KIND
bindings                                                                      true         Binding
componentstatuses                 cs                                          false        ComponentStatus
configmaps                        cm                                          true         ConfigMap
endpoints                         ep                                          true         Endpoints
events                            ev                                          true         Event
limitranges                       limits                                      true         LimitRange
namespaces                        ns                                          false        Namespace
nodes                             no                                          false        Node
persistentvolumeclaims            pvc                                         true         PersistentVolumeClaim
persistentvolumes                 pv                                          false        PersistentVolume
pods                              po                                          true         Pod
podtemplates                                                                  true         PodTemplate
replicationcontrollers            rc                                          true         ReplicationController
resourcequotas                    quota                                       true         ResourceQuota
secrets                                                                       true         Secret

Checking api-versions

$ kubectl api-versions
admissionregistration.k8s.io/v1
admissionregistration.k8s.io/v1beta1
apiextensions.k8s.io/v1
apiextensions.k8s.io/v1beta1
apiregistration.k8s.io/v1
apiregistration.k8s.io/v1beta1
apps/v1

Getting information about specific resource

$ kubectl explain pod
KIND:     Pod
VERSION:  v1

DESCRIPTION:
     Pod is a collection of containers that can run on a host. This resource is
     created by clients and scheduled onto hosts.

FIELDS:
   apiVersion	<string>
     APIVersion defines the versioned schema of this representation of an
     object. Servers should convert recognized schemas to the latest internal
     value, and may reject unrecognized values. More info:
     https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources

   kind	<string>
     Kind is a string value representing the REST resource this object
     represents. Servers may infer this from the endpoint the client submits
     requests to. Cannot be updated. In CamelCase. More info:
     https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds

   metadata	<Object>
     Standard object's metadata. More info:
     https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata

   spec	<Object>
     Specification of the desired behavior of the pod. More info:
     https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status

   status	<Object>
     Most recently observed status of the pod. This data may not be up to date.
     Populated by the system. Read-only. More info:
     https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status

Checking few utils basic command:

kubectl api-resources
kubectl api-versions
curl https://localhost:8001/apis
kubectl explain events | less
kubectl explain pod
kubectl api-version
kubectl api-versions
kubectl cluster-info
kubect explain pod
kubectl explain pod
kubectl explain pod .spec
kubectl explain pod.spec
kubectl explain pod.spec.containers
kubectl explain pod.spec.containers |less

Creating busybox pod yaml file

vi busybox.yaml
root@andregonzaga1c:~# cat busybox.yaml
apiVersion: v1
kind: Pod
metadata:
  name: busybox2
  labels:
          app: busybox
spec:
      containers:
      - name: busy
        image: busybox
        command: ['sh', '-c',  'sleep 3600']
      - name: nginx
        image: nginx

Creating busybox pod

kubectl create -f busybox.yaml
kubectl get pods
kubectl get pod busybox2
kubectl get pod all

Connecting with API with curl using proxy

kubectl proxy --port=8001 &
curl http://localhost:8001/version
curl http://localhost:8001/api/v1/namespaces/default/pods
curl http://localhost:8001/api/v1/namespaces/default/pods |less
curl http://localhost:8001/api/v1/namespaces/default/pods/busybox2

How to delete a pod through the curl API

$ curl -XDELETE http://localhost:8001/api/v1/namespaces/default/pods/busybox2

Checking the pod is deleting

$ kubectl get pods
No resources found in default namespace.

Getting information about all pods in namespaces kube-system

$ curl http://localhost:8001/api/v1/namespaces/kube-system/pods

etcdctl

How to install etcdctl

$ sudo apt-get install apt-file
or
$ yum whatprovides */etcdctl

$ sudo apt-file update

$ apt-file find etcdctl
etcd-client: /usr/bin/etcdctl
etcd-client: /usr/share/man/man1/etcdctl.1.gz

$ sudo apt-get install etcd-client

Getting help

$ etcdctl -h
NAME:
   etcdctl - A simple command line client for etcd.

Getting help with etcdctl API3. We need to declare variable before

$ ETCDCTL_API=3 etcdctl -h

Note: realise that we have different version of help while using API3, for example we have snapshot restore, save and status

Deployments

  • Namaespaces are virtual separations implemented on kubernetes to separate resources.
  • Easy implementation through quota
  • Allow us to separate customer Environment
  • There is a few default namespaces when we create our cluster
  • Default namespace is the default one where all resources are created if you don't specify a different one.
  • Kube-system is where all the infrastructure pod lives
  • Namespaces can be created through the Yaml file or command line on imperative way

Getting namespaces

$ kubectl get ns
NAME              STATUS   AGE
default           Active   3d17h
kube-node-lease   Active   3d17h
kube-public       Active   3d17h
kube-system       Active   3d17h

Describing kube-system namespace

$ kubectl describe ns kube-system
Name:         kube-system
Labels:       <none>
Annotations:  <none>
Status:       Active

No resource quota.

No LimitRange resource.

Listing all namespaces and pods and all resources

$ kubectl get all --all-namespaces
NAMESPACE     NAME                                                      READY   STATUS    RESTARTS   AGE
kube-system   pod/coredns-66bff467f8-8557g                              1/1     Running   0          3d17h
kube-system   pod/coredns-66bff467f8-rpbwc                              1/1     Running   0          3d17h
kube-system   pod/etcd-andre-vsi-dal-ubuntu-master                      1/1     Running   0          3d17h
kube-system   pod/kube-apiserver-andre-vsi-dal-ubuntu-master            1/1     Running   0          3d17h
kube-system   pod/kube-controller-manager-andre-vsi-dal-ubuntu-master   1/1     Running   0          3d17h
kube-system   pod/kube-proxy-4hntn                                      1/1     Running   0          3d17h
kube-system   pod/kube-proxy-84slw                                      1/1     Running   0          3d17h
kube-system   pod/kube-proxy-hp7lc                                      1/1     Running   0          3d17h
kube-system   pod/kube-scheduler-andre-vsi-dal-ubuntu-master            1/1     Running   0          3d17h
kube-system   pod/weave-net-lkv2t                                       2/2     Running   0          3d17h
kube-system   pod/weave-net-p5m6j                                       2/2     Running   0          3d17h
kube-system   pod/weave-net-td9t9                                       2/2     Running   0          3d17h

NAMESPACE     NAME                 TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)                  AGE
default       service/kubernetes   ClusterIP   10.96.0.1    <none>        443/TCP                  3d17h
kube-system   service/kube-dns     ClusterIP   10.96.0.10   <none>        53/UDP,53/TCP,9153/TCP   3d17h

NAMESPACE     NAME                        DESIRED   CURRENT   READY   UP-TO-DATE   AVAILABLE   NODE SELECTOR            AGE
kube-system   daemonset.apps/kube-proxy   3         3         3       3            3           kubernetes.io/os=linux   3d17h
kube-system   daemonset.apps/weave-net    3         3         3       3            3           <none>                   3d17h

NAMESPACE     NAME                      READY   UP-TO-DATE   AVAILABLE   AGE
kube-system   deployment.apps/coredns   2/2     2            2           3d17h

NAMESPACE     NAME                                 DESIRED   CURRENT   READY   AGE
kube-system   replicaset.apps/coredns-66bff467f8   2         2         2       3d17h

Creating our own namespace

$ kubectl create ns dev
namespace/dev created

Describing namespace dev and deleting it

$ kubectl describe ns dev
Name:         dev
Labels:       <none>
Annotations:  <none>
Status:       Active

No resource quota.

No LimitRange resource.
$ kubectl delete ns dev
namespace "dev" deleted

$ kubectl get ns
NAME              STATUS   AGE
default           Active   6d23h
kube-node-lease   Active   6d23h
kube-public       Active   6d23h
kube-system       Active   6d23h

Getting namespace information with yaml formatting

$ kubectl get ns dev -o yaml
apiVersion: v1
kind: Namespace
metadata:
  creationTimestamp: "2020-07-11T14:06:51Z"
  managedFields:
  - apiVersion: v1
    fieldsType: FieldsV1
    fieldsV1:
      f:status:
        f:phase: {}
    manager: kubectl
    operation: Update
    time: "2020-07-11T14:06:51Z"
  name: dev
  resourceVersion: "772836"
  selfLink: /api/v1/namespaces/dev
  uid: b0b49453-e99e-404b-a60d-91a844675be3
spec:
  finalizers:
  - kubernetes
status:
  phase: Active

Creating a deployment with command line

$ kubectl create deployment --image=nginx newnginx
deployment.apps/newnginx created

Checking all the resources created

$ kubectl get all
NAME                            READY   STATUS    RESTARTS   AGE
pod/newnginx-5f6bd64bcc-lhfrn   1/1     Running   0          39s

NAME                 TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)   AGE
service/kubernetes   ClusterIP   10.96.0.1    <none>        443/TCP   3d17h

NAME                       READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/newnginx   1/1     1            1           39s

NAME                                  DESIRED   CURRENT   READY   AGE
replicaset.apps/newnginx-5f6bd64bcc   1         1         1       39s

Note: Realise that we created a deployment, replicasset and a pod all with the name "newnginx". The rule is the deployment manages the replicasset and replicasset manages the pod.

Deleting a resource replicaset

$ kubectl delete replicasets.apps newnginx-5f6bd64bcc
replicaset.apps "newnginx-5f6bd64bcc" deleted

Note: realise that the replicaset will be automatically recreated due to deployment realise that replicaset is dead it will start a new one again

Checking new replicaset was recreated

$ kubectl get all
NAME                            READY   STATUS    RESTARTS   AGE
pod/newnginx-5f6bd64bcc-czt55   1/1     Running   0          44s

NAME                 TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)   AGE
service/kubernetes   ClusterIP   10.96.0.1    <none>        443/TCP   3d17h

NAME                       READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/newnginx   1/1     1            1           6m15s

NAME                                  DESIRED   CURRENT   READY   AGE
replicaset.apps/newnginx-5f6bd64bcc   1         1         1       44s

Note: realise that the replicaset object has 44 seconds created while deployment has 6 minutes

the same thing will happen if delete the pod. A new will pod will be recreated:

Deleting the pod

$ kubectl delete pods newnginx-5f6bd64bcc-czt55
pod "newnginx-5f6bd64bcc-czt55" deleted

$ kubectl get all
NAME                            READY   STATUS    RESTARTS   AGE
pod/newnginx-5f6bd64bcc-p9tfm   1/1     Running   0          15s

NAME                 TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)   AGE
service/kubernetes   ClusterIP   10.96.0.1    <none>        443/TCP   3d18h

NAME                       READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/newnginx   1/1     1            1           8m54s

NAME                                  DESIRED   CURRENT   READY   AGE
replicaset.apps/newnginx-5f6bd64bcc   1         1         1       3m23s

How to create a deployment yaml file

$ kubectl create deployment --dry-run=client --image=nginx --output=yaml deployment-nginx > deployment.yaml

Note: use the option --dry-run=client to send the command to yaml file and keep all the parameters to create your deployment later config

Changing replicas

$ kubectl scale deployment newnginx --replicas=3
deployment.apps/newnginx scaled
$ kubectl get deployments
NAME       READY   UP-TO-DATE   AVAILABLE   AGE
newnginx   3/3     3            3           35m

Checking all the replicas Running

$ kubectl get all
NAME                            READY   STATUS    RESTARTS   AGE
pod/newnginx-5f6bd64bcc-9r9mv   1/1     Running   0          9m49s
pod/newnginx-5f6bd64bcc-bmlxl   1/1     Running   0          9m49s
pod/newnginx-5f6bd64bcc-p9tfm   1/1     Running   0          36m

NAME                 TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)   AGE
service/kubernetes   ClusterIP   10.96.0.1    <none>        443/TCP   3d18h

NAME                       READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/newnginx   3/3     3            3           45m

NAME                                  DESIRED   CURRENT   READY   AGE
replicaset.apps/newnginx-5f6bd64bcc   3         3         3       39m

Note: realise that all the 03 replicas are running by looking at deployment, replicaset, and pods

Editing a deployment through the command line

$ kubectl edit deployment newnginx

Note: with this command you can edit variables like replica. If we change replica to different number and save the file, kubernetes will emediately change de number of replicas according to the change

$ kubectl get all
NAME                            READY   STATUS    RESTARTS   AGE
pod/newnginx-5f6bd64bcc-9r9mv   1/1     Running   0          14m
pod/newnginx-5f6bd64bcc-bmlxl   1/1     Running   0          14m
pod/newnginx-5f6bd64bcc-p9tfm   1/1     Running   0          41m
pod/newnginx-5f6bd64bcc-t24ww   1/1     Running   0          7s

NAME                 TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)   AGE
service/kubernetes   ClusterIP   10.96.0.1    <none>        443/TCP   3d18h

NAME                       READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/newnginx   4/4     4            4           49m

NAME                                  DESIRED   CURRENT   READY   AGE
replicaset.apps/newnginx-5f6bd64bcc   4         4         4       44m

Note: realise that now we have 04 replicas set

Getting deployments and showing Labels

ubuntu@andre-vsi-dal-ubuntu-master:~$ kubectl get deployments --show-labels
NAME       READY   UP-TO-DATE   AVAILABLE   AGE    LABELS
newnginx   4/4     4            4           2d4h   app=newnginx

Adding new Label to deployment

$ kubectl label deployments newnginx state=demo
deployment.apps/newnginx labeled

$ kubectl get deployments --show-labels
NAME       READY   UP-TO-DATE   AVAILABLE   AGE    LABELS
newnginx   4/4     4            4           2d4h   app=newnginx,state=demo

Using selector to select a specific label

$ kubectl get deployments --selector state=demo
NAME       READY   UP-TO-DATE   AVAILABLE   AGE
newnginx   4/4     4            4           2d4h

Getting all resources with specific labels

$ kubectl get all --selector app=newnginx
NAME                            READY   STATUS    RESTARTS   AGE
pod/newnginx-5f6bd64bcc-9r9mv   1/1     Running   0          2d5h
pod/newnginx-5f6bd64bcc-bmlxl   1/1     Running   0          2d5h
pod/newnginx-5f6bd64bcc-p9tfm   1/1     Running   0          2d5h
pod/newnginx-5f6bd64bcc-t24ww   1/1     Running   0          2d4h

NAME                       READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/newnginx   4/4     4            4           2d5h

NAME                                  DESIRED   CURRENT   READY   AGE
replicaset.apps/newnginx-5f6bd64bcc   4         4         4       2d5h

Another easy way of selecting specific label using option -l

$ kubectl get all -l state=demo
NAME                       READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/newnginx   4/4     4            4           34m

Describing deployment information and LABELS

$ kubectl describe deployments.apps newnginx
Name:                   newnginx
Namespace:              default
CreationTimestamp:      Sat, 11 Jul 2020 14:24:35 +0000
Labels:                 app=newnginx
                        state=demo
                        version=demo
Annotations:            deployment.kubernetes.io/revision: 1
Selector:               app=newnginx
Replicas:               4 desired | 4 updated | 4 total | 4 available | 0 unavailable
StrategyType:           RollingUpdate
MinReadySeconds:        0

Describing pods information and LABELS

$ kubectl describe pod newnginx-5f6bd64bcc-9r9mv
Name:         newnginx-5f6bd64bcc-9r9mv
Namespace:    default
Priority:     0
Node:         andre-vsi-dal-ubuntu-worker1/10.240.0.10
Start Time:   Sat, 11 Jul 2020 14:59:49 +0000
Labels:       app=newnginx
              pod-template-hash=5f6bd64bcc
Annotations:  <none>
Status:       Running
IP:           10.46.0.1
IPs:
  IP:           10.46.0.1
Controlled By:  ReplicaSet/newnginx-5f6bd64bcc

Checking Variables for rolling live upgrade

$ kubectl get deployments.apps newnginx -o yaml | less
...
strategy:
   rollingUpdate:
     maxSurge: 25%
     maxUnavailable: 25%
   type: RollingUpdate

Note: Realise that we have variables like maxSurge, MaxUnavailable which sets min and max pods available

Checking the manual for rollingUpdate

$ kubectl explain deployments.spec.strategy
KIND:     Deployment
VERSION:  apps/v1

RESOURCE: strategy <Object>

DESCRIPTION:
     The deployment strategy to use to replace existing pods with new ones.

     DeploymentStrategy describes how to replace existing pods with new ones.

FIELDS:
   rollingUpdate	<Object>
     Rolling update config params. Present only if DeploymentStrategyType =
     RollingUpdate.

   type	<string>
     Type of deployment. Can be "Recreate" or "RollingUpdate". Default is
     RollingUpdate.

Managing Deployment History

Rooling out

$ kubectl rollout -h
Manage the rollout of a resource.

 Valid resource types include:

  *  deployments
  *  daemonsets
  *  statefulsets

Examples:
  # Rollback to the previous deployment
  kubectl rollout undo deployment/abc

  # Check the rollout status of a daemonset
  kubectl rollout status daemonset/foo

Available Commands:
  history     View rollout history
  pause       Mark the provided resource as paused
  restart     Restart a resource
  resume      Resume a paused resource
  status      Show the status of the rollout
  undo        Undo a previous rollout

Usage:
  kubectl rollout SUBCOMMAND [options]

Use "kubectl <command> --help" for more information about a given command.
Use "kubectl options" for a list of global command-line options (applies to all commands).

Creating a new deployment with rolling $ kubectl create -f rolling.yaml deployment.apps/rolling-nginx created

check the yaml file for the new deployment

$ cat rolling.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: rolling-nginx
spec:
  replicas: 4
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 2
      maxUnavailable: 1
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      name: nginx
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:1.8

$ kubectl rollout history deployment deployment.apps/newnginx REVISION CHANGE-CAUSE 1

deployment.apps/rolling-nginx REVISION CHANGE-CAUSE 1

Edditing to change the deployment version. Updating the nginx version from 1.8 to 1.15

$ kubectl edit deployments.apps rolling-nginx

Checking history of deployments

$ kubectl rollout history deployment
deployment.apps/newnginx
REVISION  CHANGE-CAUSE
1         <none>

deployment.apps/rolling-nginx
REVISION  CHANGE-CAUSE
1         <none>
2         <none>

Getting all the resources available after the new update

$ kubectl get all
NAME                                 READY   STATUS    RESTARTS   AGE
pod/newnginx-5f6bd64bcc-9r9mv        1/1     Running   0          3d3h
pod/newnginx-5f6bd64bcc-bmlxl        1/1     Running   0          3d3h
pod/newnginx-5f6bd64bcc-p9tfm        1/1     Running   0          3d3h
pod/newnginx-5f6bd64bcc-t24ww        1/1     Running   0          3d2h
pod/rolling-nginx-6c44ccb868-7k8qh   1/1     Running   0          3m30s
pod/rolling-nginx-6c44ccb868-9cq7h   1/1     Running   0          3m21s
pod/rolling-nginx-6c44ccb868-9shzs   1/1     Running   0          3m30s
pod/rolling-nginx-6c44ccb868-szhm9   1/1     Running   0          3m30s

NAME                 TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)   AGE
service/kubernetes   ClusterIP   10.96.0.1    <none>        443/TCP   6d21h

NAME                            READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/newnginx        4/4     4            4           3d3h
deployment.apps/rolling-nginx   4/4     4            4           12m

NAME                                       DESIRED   CURRENT   READY   AGE
replicaset.apps/newnginx-5f6bd64bcc        4         4         4       3d3h
replicaset.apps/rolling-nginx-6c44ccb868   4         4         4       3m30s
replicaset.apps/rolling-nginx-6f55c5bb8b   0         0         0       12m

Describing informations and versions about specific deployment

kubectl describe deployments.apps rolling-nginx
Name:                   rolling-nginx
Namespace:              default
CreationTimestamp:      Tue, 14 Jul 2020 17:52:31 +0000
Labels:                 <none>
Annotations:            deployment.kubernetes.io/revision: 2
Selector:               app=nginx
Replicas:               4 desired | 4 updated | 4 total | 4 available | 0 unavailable
StrategyType:           RollingUpdate
MinReadySeconds:        0
RollingUpdateStrategy:  1 max unavailable, 2 max surge
Pod Template:
 Labels:  app=nginx
 Containers:
  nginx:
   Image:        nginx:1.15
   Port:         <none>
   Host Port:    <none>
   Environment:  <none>
   Mounts:       <none>
 Volumes:        <none>
Conditions:
 Type           Status  Reason
 ----           ------  ------
 Available      True    MinimumReplicasAvailable
 Progressing    True    NewReplicaSetAvailable
OldReplicaSets:  <none>
NewReplicaSet:   rolling-nginx-6c44ccb868 (4/4 replicas created)
Events:
 Type    Reason             Age    From                   Message
 ----    ------             ----   ----                   -------
 Normal  ScalingReplicaSet  15m    deployment-controller  Scaled up replica set rolling-nginx-6f55c5bb8b to 4
 Normal  ScalingReplicaSet  5m55s  deployment-controller  Scaled up replica set rolling-nginx-6c44ccb868 to 2
 Normal  ScalingReplicaSet  5m55s  deployment-controller  Scaled down replica set rolling-nginx-6f55c5bb8b to 3
 Normal  ScalingReplicaSet  5m55s  deployment-controller  Scaled up replica set rolling-nginx-6c44ccb868 to 3
 Normal  ScalingReplicaSet  5m46s  deployment-controller  Scaled down replica set rolling-nginx-6f55c5bb8b to 2
 Normal  ScalingReplicaSet  5m46s  deployment-controller  Scaled up replica set rolling-nginx-6c44ccb868 to 4
 Normal  ScalingReplicaSet  5m46s  deployment-controller  Scaled down replica set rolling-nginx-6f55c5bb8b to 1
 Normal  ScalingReplicaSet  5m45s  deployment-controller  Scaled down replica set rolling-nginx-6f55c5bb8b to 0

Checking history of deployment

 $ kubectl rollout history deployment rolling-nginx
deployment.apps/rolling-nginx
REVISION  CHANGE-CAUSE
1         <none>
2         <none>

Checking more info about specific revision (deployment version)

$ kubectl rollout history deployment rolling-nginx --revisions=1
Error: unknown flag: --revisions
See 'kubectl rollout history --help' for usage.
ubuntu@andre-vsi-dal-ubuntu-master:~/git/cka$ kubectl rollout history deployment rolling-nginx --revision=1
deployment.apps/rolling-nginx with revision #1
Pod Template:
  Labels:	app=nginx
	pod-template-hash=6f55c5bb8b
  Containers:
   nginx:
    Image:	nginx:1.8
    Port:	<none>
    Host Port:	<none>
    Environment:	<none>
    Mounts:	<none>
  Volumes:	<none>
⚠️ **GitHub.com Fallback** ⚠️