智慧屏 安装 app如何提升家庭娱乐与教育体验的关键工具
653
2022-11-30
微服务 在k8s中部署前端portal服务
在访问eurka的时候是可以看到网关服务的,这是因为在gateway的配置文件里面配置了eurka服务的,所以在启动的时候会注册到eurka当中。
[root@master portal-service]# docker build -t reg.harbor.com/microservice/portal:v1 .Sending build context to Docker daemon 47.53MBStep 1/5 : FROM java:8-jdk-alpine ---> 3fd9dd82815cStep 2/5 : RUN apk add -U tzdata && ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime ---> Using cache ---> a9034491fdd5Step 3/5 : COPY ./target/portal-service.jar ./ ---> 73f9d23d7d63Step 4/5 : EXPOSE 8080 ---> Running in 6e9075e4b750Removing intermediate container 6e9075e4b750 ---> 032bd2444ffaStep 5/5 : CMD java -jar /portal-service.jar ---> Running in f5bec1116b49Removing intermediate container f5bec1116b49 ---> 7d746f188d53Successfully built 7d746f188d53Successfully tagged reg.harbor.com/microservice/portal:v1[root@master portal-service]# docker push reg.harbor.com/microservice/portal:v1 The push refers to repository [reg.harbor.com/microservice/portal]42ba10527973: Pushed 8994a8716f11: Mounted from microservice/gateway a1e7033f082e: Mounted from microservice/gateway 78075328e0da: Mounted from microservice/gateway 9f8566ee5135: Mounted from microservice/gateway v1: digest: sha256:8b8c353179a74ba8ae035e59009dca3ead17078127f4fd38a3eb9cf430e06359 size: 1370
[root@master k8s]# cat portal.yamlapiVersion: extensions/v1beta1kind: Ingressmetadata: name: portal namespace: ms spec: rules: - host: portal.ctnrs.com paths: - path: / backend: serviceName: portal servicePort: 8080---apiVersion: v1kind: Servicemetadata: name: portal namespace: msspec: ports: - port: 8080 name: portal selector: project: ms app: portal---apiVersion: apps/v1kind: Deployment metadata: name: portal namespace: ms spec: replicas: 1 selector: matchLabels: project: ms app: portal template: metadata: labels: project: ms app: portal spec: imagePullSecrets: - name: registry-pull-secret containers: - name: portal image: reg.harbor.com/microservice/portal:v1 imagePullPolicy: Always ports: - protocol: TCP containerPort: 8080 resources: requests: cpu: 0.5 memory: 512Mi limits: cpu: 1 memory: 1Gi readinessProbe: tcpSocket: port: 8080 initialDelaySeconds: 60 periodSeconds: 10 livenessProbe: tcpSocket: port: 8080 initialDelaySeconds: 60 periodSeconds: 10
查看 portal 是否注册到 eureka 中
在浏览器访问 eureka.ctnrs.com 可看到 portal 服务已经注册到 eureka 了
访问前端页面
在浏览器访问 portal.ctnrs.com
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~