总共有两种方式:
1.创建一个nginx
kubectl create deployment web --image=nginx -o yaml --dry-run
执行上述命令就会产生如下yaml文件
W0913 04:27:48.039780 81684 helpers.go:535] --dry-run is deprecated and can be replaced with --dry-run=client.
apiVersion: apps/v1
kind: Deployment
metadata:
creationTimestamp: null
labels:
app: web
name: web
spec:
replicas: 1
selector:
matchLabels:
app: web
strategy: {
}
template:
metadata:
creationTimestamp: null
labels:
app: web
spec:
containers:
- image: nginx
name: nginx
resources: {