使用rc和svc实现应用升级 方案1
要求:
.使用rc和svc实现应用升级,要求用户访问svc的NodePort类型,升级过程中,应用不能停止,即升级过程中用户是可以访问的;
以下方式 ,是手动的关闭 容器,更新SV, 再启动容器
cat 01-rc-apps-v1.yaml
apiVersion: v1
kind: ReplicationController
metadata:
name: baimei-rc-apps-v1
spec:
replicas: 3
template:
metadata:
labels:
apps: v1
spec:
containers:
- name: v1
image: harbor.baimei.com/baimei-apps/apps:v1
#image: harbor.baimei.com/baimei-apps/apps:v2
cat 02-rc-apps-svc.yaml
apiVersion: v1
kind: Service
metadata:
name: baimei-apps
spec:
type: NodePort
selector:
apps: v1
# apps: v2
ports:
- port: 80
targetPort: 80
nodePort: 30080
cat 03-rc-apps-v2.yaml
apiVersion: v1
kind: ReplicationController
metadata:
name: baimei-rc-apps-v2
spec:
replicas: 3
template:
metadata:
labels:
apps: v2
spec:
containers:
- name: v2
# image: harbor.baimei.com/baimei-apps/apps:v1
image: harbor.baimei.com/baimei-apps/apps:v2
欢迎来撩 : 汇总all