posts - 72,comments - 18,views - 87155

 一、准备条件

1) 确保kubernetes可以访问:reg.yunwei.edu镜像库(vim /etc/hosts)
复制代码
[root@cicd yml]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
172.16.254.20 reg.yunwei.edu
#192.168.253.9 reg.yunwei.edu
192.168.253.9 cicd
192.168.253.14 node1
192.168.253.11 node2
192.168.253.10 node3
复制代码
 
 2) 然后创建sock-shop的名称空间。
  kubectl create namespace sock-shop
[root@cicd yml]# kubectl get ns
NAME          STATUS    AGE
default       Active    3d
kube-public   Active    3d
kube-system   Active    3d
sock-shop     Active    3h
weave         Active    2h

 

  3) 需要准备镜像:

 

 4) 然后进入sock-shop目录下下载所需镜像到sock-shop命名空间。
[root@cicd yml]# cd /root/kubernetes/sock-shop/
[root@cicd sock-shop]# ls
complete-demo.yaml

 

二、部署微服务

 
编辑complete-demo.yaml后,执行
kubectl apply -f complete-demo.yaml
 
查看前端service的访问端口:
kubectl get pod -n sock-shop
kubectl get service -n sock-shop
 
复制代码
[root@cicd sock-shop]# kubectl get pod -n sock-shop          sock-shoppod状态
NAME                            READY     STATUS    RESTARTS   AGE
carts-5486c9cc4f-k9j4p          1/1       Running   0          2h
carts-db-56ffbd7b87-rlkkg       1/1       Running   0          2h
catalogue-68bd49fd6d-s484q      1/1       Running   0          2h
catalogue-db-867b859dd5-5cdwv   1/1       Running   0          2h
front-end-868c9c5965-xjvcr      1/1       Running   0          2h
orders-56dd9f89d8-5jcmx         1/1       Running   0          2h
orders-db-677c4864ff-mdqp8      1/1       Running   0          2h
payment-6548fcccc8-vlhds        1/1       Running   0          2h
queue-master-7d7dd4bd9b-lbvmv   1/1       Running   0          2h
rabbitmq-74cc7558bc-c44ln       1/1       Running   0          2h
shipping-9f757f4f8-2nrq7        1/1       Running   0          2h
user-5d5b5c655f-2n47l           1/1       Running   0          2h
user-db-99f788995-xglhz         1/1       Running   1          2h

[root@cicd sock-shop]# kubectl get svc -n sock-shop        #sock-shop内svc状态
NAME           TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)        AGE
carts          ClusterIP   10.68.221.36    <none>        80/TCP         2h
carts-db       ClusterIP   10.68.165.206   <none>        27017/TCP      2h
catalogue      ClusterIP   10.68.143.207   <none>        80/TCP         2h
catalogue-db   ClusterIP   10.68.70.95     <none>        3306/TCP       2h
front-end      NodePort    10.68.128.49    <none>        80:30001/TCP   2h
orders         ClusterIP   10.68.155.168   <none>        80/TCP         2h
orders-db      ClusterIP   10.68.56.165    <none>        27017/TCP      2h
payment        ClusterIP   10.68.83.6      <none>        80/TCP         2h
queue-master   ClusterIP   10.68.255.236   <none>        80/TCP         2h
rabbitmq       ClusterIP   10.68.16.109    <none>        5672/TCP       2h
shipping       ClusterIP   10.68.185.79    <none>        80/TCP         2h
user           ClusterIP   10.68.1.194     <none>        80/TCP         2h
user-db        ClusterIP   10.68.31.241    <none>        27017/TCP      2h
复制代码

 

 三、登录浏览器验证(集群节点ip+端口:192.168.253.10:30001)

 

 
posted on   猪肉佬!  阅读(581)  评论(0编辑  收藏  举报
编辑推荐:
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

点击右上角即可分享
微信分享提示