Automatic labels and selectors

Kubernetes includes a number of imperative commands that automatically create a number of resources for you. As these commands create the resources, they also apply their own conventions for labels and use those labels to tie the resources together. A perfect example of this is the command we have used several times now: kubectl run.

For example, when we used:

kubectl run flask --image=quay.io/kubernetes-for-developers/flask:latest

This created a deployment called flask. When the controller for the deployment was created, that in turn caused the creation of a ReplicaSet for that deployment, and the ReplicaSet controller in turn created a Pod. We saw earlier that the names of these resources were all related, ...

Get Kubernetes for Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.