kubectl create deployment web --image=lizhenliang/java-demo --replicas=3 -n default
kubectl api-resources |grep Deployment
project:ecapp: portal
kind: Deploymentmetadata:name: web666namespace: team-aspec:replicas: 3selector:matchLabels:project: ecapp: portaltemplate:metadata:labels:project: ecapp: portalspec:containers:- name: webimage: lizhenliang/java-demo:latest
apiVersion: v1kind: Servicemetadata:name: web666namespace: team-aspec:ports:- port: 80protocol: TCPtargetPort: 8080selector:project: ecapp: portaltype: NodePort
kubectl apply -f deployment.yaml
kubectl apply -f service.yam
kubectl create deployment java-demo --image=nginx:1.20 -n team-a --dry-run=client -o yaml
他会输出yaml,加重定向导出即可,其中,creationTimestamp与status: {}可以删除文章来源地址https://www.toymoban.com/news/detail-470271.html
apiVersion: apps/v1kind: Deploymentmetadata:creationTimestamp: nulllabels:app: java-demoname: java-demonamespace: team-aspec:replicas: 1selector:matchLabels:app: java-demostrategy: {}template:metadata:creationTimestamp: nulllabels:app: java-demospec:containers:- image: nginx:1.20name: java-demoresources: {}status: {}
kubectl get deployment xxx -o yaml
文章来源:https://www.toymoban.com/news/detail-470271.html
到了这里,关于yaml文件格式说明及编写教程的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!