Deployment lesson

Hello,

In the video for the Deployment: CKA Certification Course - Certified Kubernetes Administrator Course | KodeKloud

I see a not needed info in the yaml file: name: myapp-pod under the spec.

That entry is not needed, as the pods take the name from the deployment name. Having it there is a bit confusing, especially for someone who is new to k8s or to k8s deployments.
You see the name mentioned in the yaml but then it does not appear anywhere in the output of the commands on the left.

Thanks

I believe you are correct; spec.template.metadata.name will be ignored, and metadata.name will be used as the base string used to generate the name of pods belonging to deployments.

As Rob says, pod name is ignored for deployments.

Pods of a deployment have a 3 part name

<deployment_name>-<replicaset_id>-<random_pod_id>

  • When you scale a deployment up or down, only the random_pod_id part changes.
  • When you edit the deployment in some way that changes the pod template, the underlying replicaset changes and you get a new replicaset_id along with new pods.

revisionHistoryLimit on the deployment spec is the number of replicasets “remembered” by the deployment, and is what makes rollbacks of deployment possible.

Yep, for such reason I was asking to remove that info. It is not used and it confuses.