Creating a Deployment
❯ kubectl apply -f deploy.yml
deployment.apps/hello-deploy created
❯ kubectl get deployment
NAME READY UP-TO-DATE AVAILABLE AGE
hello-deploy 10/10 10 6 16s
NOTE: I am following Nigel Poulton’s book examples. The “deploy.yml” YAML manifest can be found in the following repo: TheK8sBook
Inspecting a Deployment
❯ kubectl describe deployment hello-deploy
Name: hello-deploy
Namespace: default
CreationTimestamp: Wed, 16 Mar 2022 17:50:04 +0100
Labels: <none>
Annotations: deployment.kubernetes.io/revision: 1
Selector: app=hello-world
Replicas: 10 desired | 10 updated | 10 total | 10 available | 0 unavailable
StrategyType: RollingUpdate
MinReadySeconds: 10
RollingUpdateStrategy: 1 max unavailable, 1 max surge
Pod Template:
Labels: app=hello-world
Containers:
hello-pod:
Image: nigelpoulton/k8sbook:1.0
Port: 8080/TCP
Host Port: 0/TCP
Environment: <none>
Mounts: <none>
Volumes: <none>
Conditions:
Type Status Reason
---- ------ ------
Available True MinimumReplicasAvailable
Progressing True NewReplicaSetAvailable
OldReplicaSets: <none>
NewReplicaSet: hello-deploy-85fd664fff (10/10 replicas created)
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal ScalingReplicaSet 2m57s deployment-controller Scaled up replica set hello-deploy-85fd664fff to 10
Getting the ReplicaSet
The ReplicaSet gets automatically created with a Deployment.
Any of the below commands work for getting the ReplicaSet.
❯ kubectl get replicaset
NAME DESIRED CURRENT READY AGE
hello-deploy-85fd664fff 10 10 10 17m
❯ kubectl get rs
NAME DESIRED CURRENT READY AGE
hello-deploy-85fd664fff 10 10 10 17m
Inspecting the ReplicaSet
❯ kubectl describe rs hello-deploy-85fd664fff
Name: hello-deploy-85fd664fff
Namespace: default
Selector: app=hello-world,pod-template-hash=85fd664fff
Labels: app=hello-world
pod-template-hash=85fd664fff
Annotations: deployment.kubernetes.io/desired-replicas: 10
deployment.kubernetes.io/max-replicas: 11
deployment.kubernetes.io/revision: 1
Controlled By: Deployment/hello-deploy
Replicas: 10 current / 10 desired
Pods Status: 10 Running / 0 Waiting / 0 Succeeded / 0 Failed
Pod Template:
Labels: app=hello-world
pod-template-hash=85fd664fff
Containers:
hello-pod:
Image: nigelpoulton/k8sbook:1.0
Port: 8080/TCP
Host Port: 0/TCP
Environment: <none>
Mounts: <none>
Volumes: <none>
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal SuccessfulCreate 29m replicaset-controller Created pod: hello-deploy-85fd664fff-swx8b
Normal SuccessfulCreate 29m replicaset-controller Created pod: hello-deploy-85fd664fff-8cbx7
Normal SuccessfulCreate 29m replicaset-controller Created pod: hello-deploy-85fd664fff-sthxv
Normal SuccessfulCreate 29m replicaset-controller Created pod: hello-deploy-85fd664fff-g8bfk
Normal SuccessfulCreate 29m replicaset-controller Created pod: hello-deploy-85fd664fff-7prbs
Normal SuccessfulCreate 29m replicaset-controller Created pod: hello-deploy-85fd664fff-8fxvc
Normal SuccessfulCreate 29m replicaset-controller Created pod: hello-deploy-85fd664fff-xp55x
Normal SuccessfulCreate 29m replicaset-controller Created pod: hello-deploy-85fd664fff-4nf7z
Normal SuccessfulCreate 29m replicaset-controller Created pod: hello-deploy-85fd664fff-xv78n
Normal SuccessfulCreate 29m replicaset-controller (combined from similar events): Created pod: hello-deploy-85fd664fff-2bvnx
I will continue with more tests, so look for “Working With Deployments 2.md” (or similar) in my TIL section if interested.