Viewing labels

The deployments we made earlier through the kubectl run commands put in place labels and used them as selectors. As you saw earlier, you can get all the underlying detail for a Kubernetes resource using the kubectl get -o json command.

A similar command is kubectl describe, which is intended to provide a human-readable overview of a resource and its recent history:

kubectl describe deployment flask

This will provide output akin to the following:

Name: flaskNamespace: defaultCreationTimestamp: Sat, 16 Sep 2017 08:31:00 -0700Labels: pod-template-hash=866287979        run=flaskAnnotations: deployment.kubernetes.io/revision=1kubectl.kubernetes.io/last-applied-configuration={"apiVersion":"apps/v1beta1","kind":"Deployment","metadata":{"annotations":{},"labels":{"run":"flask"},"name":"flask","namespace":"default"},"spec":{"t... ...

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.