May 2018
Intermediate to advanced
554 pages
13h 51m
English
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, ... |