https://kubernetes.io/docs/reference/kubectl/conventions/#generators
the only non-deprecated generatori is "run-pod/v1" :
kubectl run nginx --image=nginx --generator=run-pod/v1 --dry-run -o yaml
kubectl run nginx --image=nginx --dry-run -o yaml
#create nginx POD only
kubectl run nginx --image=nginx --port=80 --restart=Never --dry-run -o yaml
#create deployment nginx and pod
kubectl run nginx --image=nginx --port=80 --restart=Always --dry-run -o yaml
the only non-deprecated generatori is "run-pod/v1" :
kubectl run nginx --image=nginx --generator=run-pod/v1 --dry-run -o yaml
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: null
labels:
run: nginx
name: nginx
spec:
containers:
- image: nginx
imagePullPolicy: IfNotPresent
name: nginx
resources: {}
dnsPolicy: ClusterFirst
restartPolicy: Always
status: {}
kubectl run nginx --image=nginx --dry-run -o yaml
apiVersion: apps/v1beta1
kind: Deployment
metadata:
creationTimestamp: null
labels:
run: nginx
name: nginx
spec:
replicas: 1
selector:
matchLabels:
run: nginx
strategy: {}
template:
metadata:
creationTimestamp: null
labels:
run: nginx
spec:
containers:
- image: nginx
name: nginx
resources: {}
status: {}
#create nginx POD only
kubectl run nginx --image=nginx --port=80 --restart=Never --dry-run -o yaml
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: null
labels:
run: nginx
name: nginx
spec:
containers:
- image: nginx
imagePullPolicy: IfNotPresent
name: nginx
ports:
- containerPort: 80
resources: {}
dnsPolicy: ClusterFirst
restartPolicy: Never
status: {}
#create deployment nginx and pod
kubectl run nginx --image=nginx --port=80 --restart=Always --dry-run -o yaml
apiVersion: apps/v1beta1
kind: Deployment
metadata:
creationTimestamp: null
labels:
run: nginx
name: nginx
spec:
replicas: 1
selector:
matchLabels:
run: nginx
strategy: {}
template:
metadata:
creationTimestamp: null
labels:
run: nginx
spec:
containers:
- image: nginx
name: nginx
ports:
- containerPort: 80
resources: {}
status: {}