[liwm@rmaster01 ~]$ kubectl run --image=nginx my-web -o yaml --dry-run
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.
apiVersion: apps/v1
kind: Deployment
metadata:
creationTimestamp: null
labels:
run: my-web
name: my-web
spec:
replicas: 1
selector:
matchLabels:
run: my-web
strategy: {}
template:
metadata:
creationTimestamp: null
labels:
run: my-web
spec:
containers:
- image: nginx
name: my-web
resources: {}
status: {}
[liwm@rmaster01 ~]$
[liwm@rmaster01 ~]$ cat nginx-deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
labels:
app: nginx-deploy
spec:
replicas: 1
selector:
matchLabels:
app: nginx-pod
template:
metadata:
labels:
app: nginx-pod
spec:
containers:
- name: nginx
image: nginx:1.7.6
imagePullPolicy: IfNotPresent
ports:
- containerPort: 80
[liwm@rmaster01 ~]$