本文主要是介绍kubernetes Deployment介绍,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
一、deployment
Deployment在继承Pod和Replicaset的所有特性的同时, 它可以实现对template模板进行实时滚动更新并具备我们线上的Application life circle的特性.
二、操作命令
1. 创建deployment
vi deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:name: httpd-deploymentlabels:app: httpd-deployment
spec:replicas: 2selector:matchLabels:app: httpd-demotemplate:metadata:labels:app: httpd-demospec:containers:- name: httpdimage: httpdimagePullPolicy: Alwaysports:- containerPort: 80env:- name: VERSIONvalue: "v1"
kubectl create -f deployment.yaml
2. 查看Deployment
kubectl get deployment
kubectl get pods -o wide
kubectl describe deployment
3. 更新deployment
# 通过此命令可以呼出vi编辑器对模板进行编辑.
kubectl edit -f deployment.yaml# 通过此命令使当前编辑结果生效.
kubectl apply -f deployment.yaml# 再次查看可以看到老版本的deployment已经下架, 新版本的已经生效.
kubectl get deployment
4. 扩容与缩容
# 可以修改replicas的赋值对deployment进行扩容与缩容
kubectl scale deployment/httpd-deployment --replicas=1
5. 删除deployment
kubectl delete deployment httpd-deployment
https://blog.csdn.net/bbwangj/article/details/81812675
这篇关于kubernetes Deployment介绍的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!