1.在Apollo的portal创建dubbo消费者项目
(1)添加dubbo消费者项目
(2)在dubbo消费者项目中添加配置项
(3)发布
2.通过jenkins构建dubbo消费者镜像
3.登录私有仓库harbor查看是否已上传
4.修改之前的dubbo消费者的deployment.yaml资源配置清单
在运维主机mfyxw50.mfyxw.com上操作
[root@mfyxw50 ~]# cat > /data/k8s-yaml/dubbo-demo-consumer/deployment.yaml << EOF
kind: Deployment
apiVersion: extensions/v1beta1
metadata:
name: dubbo-demo-consumer
namespace: app
labels:
name: dubbo-demo-consumer
spec:
replicas: 1
selector:
matchLabels:
name: dubbo-demo-consumer
template:
metadata:
labels:
app: dubbo-demo-consumer
name: dubbo-demo-consumer
spec:
containers:
- name: dubbo-demo-consumer
image: harbor.od.com/app/dubbo-demo-consumer:apollo_20200709_1441
ports:
- containerPort: 8080
protocol: TCP
- containerPort: 20880
protocol: TCP
env:
- name: JAR_BALL
value: dubbo-client.jar
- name: C_OPTS
value: -Denv=dev -Dapollo.meta=http://config.od.com
imagePullPolicy: IfNotPresent
imagePullSecrets:
- name: harbor
restartPolicy: Always
terminationGracePeriodSeconds: 30
securityContext:
runAsUser: 0
schedulerName: default-scheduler
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 1
maxSurge: 1
revisionHistoryLimit: 7
progressDeadlineSeconds: 600
EOF
5.重新应用dubbo消费者的deployment.yaml资源配置清单
在master节点(mfyxw30.mfyxw.com或mfyxw40.mfyxw.com)任意一台执行
[root@mfyxw30 ~]# kubectl get pod -n app
NAME READY STATUS RESTARTS AGE
dubbo-demo-consumer-6c7f6f598b-l2gdx 1/1 Running 12 23d
dubbo-demo-service-6c99776d74-xxkr7 1/1 Running 4 28h
[root@mfyxw30 ~]#
[root@mfyxw30 ~]# kubectl apply -f http://k8s-yaml.od.com/dubbo-demo-consumer/deployment.yaml
deployment.extensions/dubbo-demo-consumer configured
[root@mfyxw30 ~]#
[root@mfyxw30 ~]# kubectl get pod -n app
NAME READY STATUS RESTARTS AGE
dubbo-demo-consumer-ccb4d6549-g6h6k 1/1 Running 0 3s
dubbo-demo-service-6c99776d74-xxkr7 1/1 Running 4 28h