1. [liwm@rmaster01 ~]$ kubectl run --image=nginx my-web -o yaml --dry-run
    2. kubectl run --generator=deployment/apps.v1 is DEPRECATED and will be removed in a future version. Use kubectl run --generator=run-pod/v1 or kubectl create instead.
    3. apiVersion: apps/v1
    4. kind: Deployment
    5. metadata:
    6. creationTimestamp: null
    7. labels:
    8. run: my-web
    9. name: my-web
    10. spec:
    11. replicas: 1
    12. selector:
    13. matchLabels:
    14. run: my-web
    15. strategy: {}
    16. template:
    17. metadata:
    18. creationTimestamp: null
    19. labels:
    20. run: my-web
    21. spec:
    22. containers:
    23. - image: nginx
    24. name: my-web
    25. resources: {}
    26. status: {}
    1. [liwm@rmaster01 ~]$
    2. [liwm@rmaster01 ~]$ cat nginx-deployment.yaml
    3. apiVersion: apps/v1
    4. kind: Deployment
    5. metadata:
    6. name: nginx-deployment
    7. labels:
    8. app: nginx-deploy
    9. spec:
    10. replicas: 1
    11. selector:
    12. matchLabels:
    13. app: nginx-pod
    14. template:
    15. metadata:
    16. labels:
    17. app: nginx-pod
    18. spec:
    19. containers:
    20. - name: nginx
    21. image: nginx:1.7.6
    22. imagePullPolicy: IfNotPresent
    23. ports:
    24. - containerPort: 80
    25. [liwm@rmaster01 ~]$