交付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解析,来验证: