微服务 在k8s中部署订单order服务

网友投稿 339 2022-11-02


微服务 在k8s中部署订单order服务

1)构建镜像

[root@master order-service]# cd order-service-biz/[root@master order-service-biz]# lsDockerfile pom.xml src target[root@master order-service-biz]# cat Dockerfile FROM java:8-jdk-alpineRUN apk add -U tzdata && \ ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtimeCOPY ./target/order-service-biz.jar ./EXPOSE 8020CMD java -jar /order-service-biz.jar[root@master order-service-biz]# docker build -t reg.harbor.com/microservice/order:v1 .Sending build context to Docker daemon 45.94MBStep 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/order-service-biz.jar ./ ---> 25c3a137078aStep 4/5 : EXPOSE 8020 ---> Running in 57f22b0a96b3Removing intermediate container 57f22b0a96b3 ---> e9a11bc917b2Step 5/5 : CMD java -jar /order-service-biz.jar ---> Running in e18775330a8aRemoving intermediate container e18775330a8a ---> b9d75b047b0aSuccessfully built b9d75b047b0aSuccessfully tagged reg.harbor.com/microservice/order:v1[root@master order-service-biz]# docker push reg.harbor.com/microservice/order:v1

2)部署服务

[root@master k8s]# cat order.yaml apiVersion: apps/v1kind: Deployment metadata: name: order namespace: ms spec: replicas: 1 selector: matchLabels: project: ms app: order template: metadata: labels: project: ms app: order spec: imagePullSecrets: - name: registry-pull-secret containers: - name: order image: reg.harbor.com/microservice/order:v1 imagePullPolicy: Always resources: requests: cpu: 0.5 memory: 256Mi limits: cpu: 1 memory: 1Gi ports: - protocol: TCP containerPort: 8020 readinessProbe: tcpSocket: port: 8020 initialDelaySeconds: 60 periodSeconds: 10 livenessProbe: tcpSocket: port: 8020 initialDelaySeconds: 60 periodSeconds: 10[root@master k8s]# kubectl get pod -n msNAME READY STATUS RESTARTS AGEeureka-0 1/1 Running 0 2d22heureka-1 1/1 Running 1 2d22heureka-2 1/1 Running 1 2d22hgateway-77bb7dbbc8-xqkk5 1/1 Running 0 47horder-55c7cfb854-mjf7p 1/1 Running 0 9m51sportal-56d598d98d-qx4qd 1/1 Running 0 25h


版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:SpringCloud 组件 服务发现与注册组件 Eureka
下一篇:IntelliJ IDEA 2021.1 EAP 1 发布支持 Java 16 和 WSL 2
相关文章

 发表评论

暂时没有评论,来抢沙发吧~