Tomcat部署流程
kubectl create deployment tomcat --image=tomcat
kubectl expose deployment tomcat --port=8080 --type=NodePort
访问地址:http://NodeIP:Port
Tomcat 部署详情
运行kubectl create deployment tomcat --image=tomcat
[root@k8smaster ~]# kubectl create deployment tomcat --image=tomcat
deployment.apps/tomcat created
查看kubectl get pod
成功状态如下
[root@k8smaster ~]# kubectl get pod
NAME READY STATUS RESTARTS AGE
nginx-85b98978db-w87hr 1/1 Running 0 159m
tomcat-655b94657b-dmthn 1/1 Running 0 83s
kubectl expose 编排
[root@k8smaster ~]# kubectl expose deploy tomcat --port=8080 --type=NodePort
service/tomcat exposed
查看服务
[root@k8smaster ~]# kubectl get svc
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.66.0.1 <none> 443/TCP 2d1h
nginx NodePort 10.66.32.86 <none> 80:31617/TCP 160m
tomcat NodePort 10.66.40.83 <none> 8080:30780/TCP 115s
访问 http://192.168.116.104:30780/
Tomcat 安装成功效果
查看命名空间
[root@k8smaster ~]# kubectl get namespace
NAME STATUS AGE
default Active 2d1h
kube-node-lease Active 2d1h
kube-public Active 2d1h
kube-system Active 2d1h
网友评论