[root@master tomcat]# vim tomcat-service.yaml
apiVersion: v1
kind: Service
metadata:
name: my-tomcat
spec:
type: NodePort
ports:
- port: 8080
targetPort: 8080
nodePort: 31111
selector:
app: my-tomcat
[root@master tomcat]# kubectl create -f tomcat-deployment.yaml
[root@master tomcat]# kubectl create -f tomcat-service.yaml
[root@master tomcat]# kubectl get deployment
NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
my-tomcat 2 2 2 2 59m
[root@master tomcat]# kubectl get svc
NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes 10.254.0.1 <none> 443/TCP 10d
my-tomcat 10.254.110.240 <nodes> 8080:31111/TCP 59m
nginx-service 10.254.208.231 <nodes> 80:30011/TCP 1d
[root@master tomcat]# kubectl get pods -o wide
NAME READY STATUS RESTARTS AGE IP NODE
my-tomcat-464109745-ctmdf 1/1 Running 0 1h 10.255.1.5 node1
my-tomcat-464109745-wmxpz 1/1 Running 0 1h 10.255.95.4 node2
nginx-pod 1/1 Running 1 1d 10.255.95.2 node2
nginx-rc-351xd 1/1 Running 1 1d 10.255.1.3 node1
访问tomcat
:31111
:31111
Linux公社的RSS地址:https://www.linuxidc.com/rssFeed.aspx
本文永久更新链接地址:https://www.linuxidc.com/Linux/2019-07/159549.htm
相关资讯 Kubernetes部署Nginx Kubernetes部署Tomcat
本文评论 查看全部评论 (0)
尊重网上道德,遵守中华人民共和国的各项有关法律法规 承担一切因您的行为而直接或间接导致的民事或刑事法律责任 本站管理人员有权保留或删除其管辖留言中的任意内容 本站有权在网站内转载或引用您的评论 参与本评论即表明您已经阅读并接受上述条款
评论声明
最新资讯