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/