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...

You may run the kubectl run command to recreate my-nginx, or write a Deployments configuration file that produces the same result. This is a great opportunity to learn about the Deployment configuration file. 

This example is an equivalent of kubectl run my-nginx --image=nginx:1.11.0 --port=80 --replicas=3:

$ cat deploy.yaml apiVersion: apps/v1kind: Deploymentmetadata:  name: my-nginxspec:  replicas: 3  selector:    matchLabels:      run: my-nginx  template:    metadata:      labels:        run: my-nginx    spec:      containers:      - name: my-nginx        image: nginx:1.11.0        ports:        - containerPort: 80

These parameters, sorted by key and value, are described here:

Key

Value

Description

apiVersion

apps/v1

Until Kubernetes v1.8, it had been used apps/v1Beta1, ...

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