kubernetes real - dubbo delivery service to k8s cluster (vi) using blue ocean pipeline constructed dubbo-consumer services

We are here dubbo-consumer dubbo-demo-service consumer:

We have previously configured in jenkins good line, just fill out the parameters on the line.

Because gitee private warehouse dubbo-consumer use, you need to add the public key, here you can find yourself a client service to do the experiment.

 

 

 

 

 

Here's what we built mirrored by jenkins, has been uploaded to our harbor among the private warehouse:

 

 

 Here we constructed twice, construction of the two mirrors, 11bb9cd the production of hair used for simulation experiments updated version.

Preparing a list of resources:

1, dp.yaml  red part modified according to the actual image tag

# mkdir /data/k8s-yaml/dubbo-consumer
# cd /data/k8s-yaml/dubbo-consumer
# Vi dp.yaml
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:master_191201_1600
        ports:
        - containerPort: 8080
          protocol: TCP
        - containerPort: 20880
          protocol: TCP
        env:
        - name: JAR_BALL
          value: dubbo-client.jar
        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

2、svc.yaml

# vi svc.yaml
kind: Service
apiVersion: v1
metadata: 
  name: dubbo-demo-consumer
  namespace: app
spec:
  ports:
  - protocol: TCP
    port: 8080
    targetPort: 8080
  selector: 
    app: dubbo-demo-consumer

3、ingress.yaml

# vi ingress.yaml
kind: Ingress
apiVersion: extensions/v1beta1
metadata: 
  name: dubbo-demo-consumer
  namespace: app
spec:
  rules:
  - host: demo.od.com
    http:
      paths:
      - path: /
        backend: 
          serviceName: dubbo-demo-consumer
          servicePort: 8080

 

应用资源配置清单:

# kubectl apply -f http://k8s-yaml.od.com/dubbo-consumer/dp.yaml
# kubectl apply -f http://k8s-yaml.od.com/dubbo-consumer/svc.yaml
# kubectl apply -f http://k8s-yaml.od.com/dubbo-consumer/ingress.yaml
# kubectl get pod -n app

 

 查看log,是否启动成功:

# kubectl logs dubbo-demo-consumer-f8d5f5f74-dgmqd -n app

 

检查dubbo-monitor是否已经注册成功:

 

添加个dns解析,来验证:

# vi /var/named/od.com.zone
# systemctl restart named

 

 浏览器访问http://demo.od.com/hello?name=slim

 

 

 接下来我们模拟升级发版,我们提前修改了代码,并提交到了git仓库,发版的前提是使用jenkins提前构建了镜像并且上传到了我们的私有harbor仓库中,具体的构建流程不在赘述,只需要将远程git仓库的版本修改后构建就行了。

修改dp.yaml资源配置清单,修改harbor镜像仓库中对应的tag版本:

 

# vi dp.yaml

 

 

 应用修改后的资源配置清单,当然也可以在dashboard中进行在线修改:

 

# kubectl apply -f http://k8s-yaml.od.com/dubbo-consumer/dp.yaml

 

 已经启动起来了,使用浏览器验证:http://demo.od.com/hello?name=slim

 

 

至此,我们一套完成的dubbo服务就已经交付到k8s集群当中了,并且也演示了如何发版。

 

Guess you like

Origin www.cnblogs.com/slim-liu/p/11984845.html