基于RKE | 在kubernetes进行Dubbo RPC微服务部署实战

原创
2020/04/06 16:02
阅读数 205

准备物料


zookeeper

192.168.88.163






拉取项目


git@github.com:hujf2/spring-cloud-learning-rancher.git



拉取zookeeper 镜像, 并启动


docker run --name some-zookeeper --restart always -d zookeeper
docker ps
[root@base-node ~]# docker psCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMESf0aed0b4563b 192.168.88.165:5000/myapp/microservice/dubbo-consumer "/bin/sh -c 'exec ja…" 28 minutes ago Up 28 minutes k8s_my-dubbo-consumer_my-dubbo-consumer-655564c585-kcjzx_myapp_d110fb12-7472-4d9e-ad19-ece19edcb2f9_08e430e7019a3 rancher/pause:3.1 "/pause" 28 minutes ago Up 28 minutes k8s_POD_my-dubbo-consumer-655564c585-kcjzx_myapp_d110fb12-7472-4d9e-ad19-ece19edcb2f9_08c5027d696e8 192.168.88.165:5000/myapp/microservice/dubbo-provider "/bin/sh -c 'exec ja…" 31 minutes ago Up 31 minutes k8s_my-dubbo-provider_my-dubbo-provider-5f5b5d6475-kb7fs_myapp_c147401a-7bc5-48a0-b0ae-3f83fc122095_0d66bd67522cf rancher/pause:3.1 "/pause" 31 minutes ago Up 31 minutes k8s_POD_my-dubbo-provider-5f5b5d6475-kb7fs_myapp_c147401a-7bc5-48a0-b0ae-3f83fc122095_0b1d3330edc0c zookeeper "/docker-entrypoint.…" 44 minutes ago Up 44 minutes 2888/tcp, 3888/tcp, 0.0.0.0:2181->2181/tcp, 8080/tcp some-zookeeper26b0171a65c4 e2fedec23950 "run.sh" 2 hours ago Up 2 hours k8s_agent_cattle-node-agent-txvkg_cattle-system_c008d733-1e0d-41c8-8964-dc31dca76c1d_8c0734dc3c001 ff281650a721 "/opt/bin/flanneld -…" 2 hours ago Up 2 hours k8s_kube-flannel_canal-p5n62_kube-system_2334a838-f62b-4d07-bd4e-634c056cfee7_30ced4dbc04be d6abb567faf1 "start_runit" 2 hours ago Up 2 hours k8s_calico-node_canal-p5n62_kube-system_2334a838-f62b-4d07-bd4e-634c056cfee7_267155e38a999 70f311871ae1 "/coredns -conf /etc…" 2 hours ago Up 2 hours k8s_coredns_coredns-7c5566588d-f6bf8_kube-system_c584810d-3e55-47cd-88e6-10300c7fbbb7_2a42e7a2f38e6 rancher/pause:3.1 "/pause" 2 hours ago Up 2 hours k8s_POD_coredns-7c5566588d-f6bf8_kube-system_c584810d-3e55-47cd-88e6-10300c7fbbb7_39da41feb16a0 a80ffa0b898e "/usr/bin/dumb-init …" 2 hours ago Up 2 hours k8s_nginx-ingress-controller_nginx-ingress-controller-gg2ld_ingress-nginx_ee5dc9cb-13b8-4380-8363-2b2747dff94f_241cdf25da775 rancher/pause:3.1 "/pause" 2 hours ago Up 2 hours k8s_POD_canal-p5n62_kube-system_2334a838-f62b-4d07-bd4e-634c056cfee7_2f15e8626c954 rancher/pause:3.1 "/pause" 2 hours ago Up 2 hours k8s_POD_nginx-ingress-controller-gg2ld_ingress-nginx_ee5dc9cb-13b8-4380-8363-2b2747dff94f_214baee403415 rancher/pause:3.1 "/pause" 2 hours ago Up 2 hours k8s_POD_cattle-node-agent-txvkg_cattle-system_c008d733-1e0d-41c8-8964-dc31dca76c1d_295f95934d5d8 rancher/hyperkube:v1.17.4-rancher1 "/opt/rke-tools/entr…" 26 hours ago Up 2 hours kube-proxyf47f47008f10 rancher/rke-tools:v0.1.56 "nginx-proxy CP_HOST…" 26 hours ago Up 2 hours nginx-proxyb94747e600a1 rancher/hyperkube:v1.17.4-rancher1 "/opt/rke-tools/entr…" 26 hours ago Up 2 hours kubelet[root@base-node ~]#



构建2个镜像


docker build -t myapp/microservice/dubbo-provider .


docker build -t myapp/microservice/dubbo-consumer .
   [root@node165 micro-consumer]# docker push 192.168.88.165:5000/myapp/microservice/dubbo-consumerThe push refers to repository [192.168.88.165:5000/myapp/microservice/dubbo-consumer]f6e50fa91f4f: Pushed 636a0304343d: Pushed 817d50aa00f8: Pushed 59563b6365c8: Mounted from myapp/microservice/dubbo-provider 1d0d07e9df21: Mounted from myapp/microservice/dubbo-provider 27860a0ae428: Mounted from myapp/microservice/dubbo-provider 60e83c8e2fcc: Mounted from myapp/microservice/dubbo-provider 983855c885d4: Mounted from myapp/microservice/dubbo-provider cdb3f9544e4c: Mounted from myapp/microservice/dubbo-provider latest: digest: sha256:8937189a003b433e812703f4c049ad6eabae2574d565b0f4c3d9e9c404b274dc size: 2201


[root@node165 micro-provider]# docker push 192.168.88.165:5000/myapp/microservice/dubbo-provider:latestThe push refers to repository [192.168.88.165:5000/myapp/microservice/dubbo-provider]efe408800aba: Pushed e892bf507ddd: Pushed 6ef157546cb3: Pushed 59563b6365c8: Mounted from my/k8s/microservice/myapp 1d0d07e9df21: Mounted from my/k8s/microservice/myapp 27860a0ae428: Mounted from my/k8s/microservice/myapp 60e83c8e2fcc: Mounted from my/k8s/microservice/myapp 983855c885d4: Mounted from my/k8s/microservice/myapp cdb3f9544e4c: Mounted from my/k8s/microservice/myapp


修改一下docker tag

192.168.88.165:5000/myapp/microservice/dubbo-provider192.168.88.165:5000/myapp/microservice/dubbo-consumer


创建连个工作负载





部署成功后, 通过浏览器打开


http://192.168.88.163:31001/initOrder?id=111




进群看视频


钉钉群号:30931101


如果你需要进入腾哥的技术讨论群, 添加腾哥微信:419644560

大量粉丝还没有养成阅读后点赞和分享、转发的习惯,希望大家在阅读后顺便点赞、分享和转发,以示鼓励。让我们一起来关注微服务架构,支持腾哥。


本文分享自微信公众号 - 架构师智库(beijing-tmt)。
如有侵权,请联系 support@oschina.cn 删除。
本文参与“OSC源创计划”,欢迎正在阅读的你也加入,一起分享。

展开阅读全文
打赏
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部