参考:https://core815.blog.csdn.net/article/details/119535868中,步骤1-3完成镜像构建。
2、上传镜像到Docker Hubdocker login # 配置tag,DockerHub账号/镜像名称 docker tag sentinel:1.6.3 core815/sentinel:1.6.3 # push docker push core815/sentinel:1.6.33、使用deployment部署
apiVersion: apps/v1 kind: Deployment metadata: name: sentinel-deployment labels: app: sentinel spec: replicas: 1 selector: matchLabels: app: sentinel template: metadata: labels: app: sentinel spec: containers: - name: sentinel imagePullPolicy: Always # 如果没有此设置,会导致一直不拉取DockerHub最新镜像 image: core815/sentinel:1.6.3 ports: - containerPort: 99994、使用service对外暴露端口
apiVersion: v1 kind: Service metadata: name: sentinel-service spec: type: NodePort selector: app: sentinel ports: - name: http protocol: TCP port: 9999 targetPort: 9999
执行如下命令创建商品服务的service:
kubectl apply -f sentinel-service.yaml
查看对外暴露端口:
kubectl get svc|grep sentinel
访问sentinel:
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)