分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > IT知识

kubernets之service测试

发布时间:2023-09-06 01:50责任编辑:蔡小小关键词:暂无标签
部署nginx service做测试。
部署nginx:
kubectl run nginx --image=nginx ?--replicas=2 --labels="run=load-nginx-example" --port=80 ##端口一定是80要不然访问不成功,提示拒绝连接

查看信息:kubectl get pods --all-namespaces -o wide |grep nginx

定义service:
kubectl expose deployment nginx --type=NodePort --name=test-service
详细信息:
kubectl describe svc test-service

[root@k8s ~]# kubectl describe svc test-service
Name: ????????????????????test2-service
Namespace: ???????????????default
Labels: ??????????????????run=load-nginx-example
Annotations: ?????????????<none>
Selector: ????????????????run=load-nginx-example
Type: ????????????????????NodePort
IP: ??????????????????????10.98.153.124
Port: ????????????????????<unset> ?80/TCP
TargetPort: ??????????????80/TCP
NodePort: ????????????????<unset> ?32197/TCP
Endpoints: ???????????????10.244.1.4:80,10.244.1.5:80
Session Affinity: ????????None
External Traffic Policy: ?Cluster
Events: ??????????????????<none>

测试以下几个地址:
curl http://10.98.153.124:80


curl: http://10.244.1.5:80

curl http://192.168.147.191:32197

curl http://192.168.147.192:32197

kubernets之service测试

原文地址:http://blog.51cto.com/mrdeng/2105179

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved