Java教程

Deployment 大全 20220423

本文主要是介绍Deployment 大全 20220423,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

deployment 大全

 


1)、部署
kubel apply -f xxx.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
name: web
### namespace : default
spec:
replicas: 3 #pod副本数量
selector:
matchLabels:
app: nginx
template:nginx
metadata:
labels:
app: web #pod副本标签
spec:
containers:
- name: nginx
image: nginx:1.16
ports:
- containerPort: 80

2)、镜像升级
####滚动升级################
###kubel set image deployment/web nginx=nginx:1.17


###kubectl get pods
###kubectl delete deployment web
###kubectl get services
###kubectl delete service web
###kubectl get pods,service

 

 

 

 

 

 


                         i)、###部署deployment.yaml

vi deployment.yaml

 

 


######deployment、service

demo.yaml

 

 


kubectl apply -f  deployment.yaml
##kubectl get pods,service

 

端口暴露

 

 

 

 

 

http://192.168.254.149:30787/


                   ii)、###升级nginx:1.17
vi deployment.yaml

 

 


image: nginx:1.17 ###1.16--->1.17
kubectl apply -f deployment.yaml

 

 


##kubectl get pods,service

 

 


http://192.168.254.149:30787/

这篇关于Deployment 大全 20220423的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!