交付dubbo-demo-web

Posted sseban

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了交付dubbo-demo-web相关的知识,希望对你有一定的参考价值。

我们这里的dubbo-consumer是dubbo-demo-service的消费者:

我们之前已经在jenkins配置好了流水线,只需要填写参数就行了。

由于dubbo-consumer用的gitee的私有仓库,需要添加公钥,这里大家可以自己找个client服务来做实验。

1.jenkins构建

技术图片下面是我们通过jenkins构建的镜像,已经上传到我们的harbor私有仓库当中了:

技术图片

2.准备资源配置清单:

1、dp.yaml  红色部分根据实际镜像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

svc

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

ingress

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

3应用资源配置清单:

# 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

[root@hdss7-22 data]#  kubectl logs dubbo-demo-consumer-c6f7f89f4-q9ltz -n app

技术图片

4.添加个dns解析,来验证:

技术图片技术图片

 

以上是关于交付dubbo-demo-web的主要内容,如果未能解决你的问题,请参考以下文章

实施类似交付应用程序地图设计的 Swiggy

2022 年主要的技术变革内容

什么是Sprint?

Woocommerce 交付和付款选项 - 我的 php 代码有啥问题?

持续交付之如何选型代码分支策略?

持续集成+持续交付+持续部署