k8s快速生成yaml格式文件命令

 

 

kubectl create deployment web --image=nginx -o yaml --dry-run >my1.yaml

然后会生成到当前目录下的my1.yaml文件里

 

内容如下

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: {}
status: {}

 

posted @ 2022-01-02 16:29  yvioo  阅读(116)  评论(0编辑  收藏  举报