Skip to Content
Kubernetes Cookbook - Second Edition
book

Kubernetes Cookbook - Second Edition

by Hideto Saito, Hui-Chuan Chloe Lee, Ke-Jou Carol Hsu
May 2018
Intermediate to advanced
554 pages
13h 51m
English
Packt Publishing
Content preview from Kubernetes Cookbook - Second Edition

How to do it...

For assigning a name to the Pod, follow the following steps:

  1. The following example is the Pod YAML configuration that assigns the Pod name as my-pod to the container name as my-container; you can successfully create it as follows:
# cat my-pod.yaml
apiVersion: v1
kind: Pod
metadata:
  name: my-pod
spec:
  containers:
  - name: my-container    image: nginx # kubectl create -f my-pod.yamlpod "my-pod" created# kubectl get podsNAME      READY     STATUS    RESTARTS   AGEmy-pod    0/1       Running   0          4s
  1. You can use the kubectl describe command to see the container named my-container as follows:
$ kubectl describe pod my-podName:         my-podNamespace:    defaultNode:         minikube/192.168.64.12Start Time:   Sat, 16 Dec 2017 10:53:38 -0800Labels:       <none>Annotations: ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Kubernetes Cookbook

Kubernetes Cookbook

Sébastien Goasguen, Michael Hausenblas
DevOps with Kubernetes - Second Edition

DevOps with Kubernetes - Second Edition

Hideto Saito, Hui-Chuan Chloe Lee, Cheng-Yang Wu

Publisher Resources

ISBN: 9781788837606Supplemental Content