查看“How to Deploy Tomcat on k8s”的源代码
←
How to Deploy Tomcat on k8s
跳到导航
跳到搜索
因为以下原因,您没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看与复制此页面的源代码。
=k8s部署tomcat= ==Deployment== <pre> root@k8s-master ~]# cat tomcat.yml apiVersion: apps/v1 kind: Deployment metadata: name: tomcat-deployment labels: app: tomcat spec: replicas: 3 selector: matchLabels: app: tomcat template: metadata: labels: app: tomcat spec: containers: - name: tomcat image: tomcat:latest ports: - containerPort: 8080 #run [root@k8s-master ~]# kubectl apply -f tomcat.yml deployment.apps/tomcat-deployment created </pre> 具体Deployment编写细节请参考以下地址: https://kubernetes.io/zh/docs/concepts/workloads/controllers/deployment/ == 查看 和状态== <pre> kubectl get deployments NAME READY UP-TO-DATE AVAILABLE AGE tomcat-deployment 3/3 3 3 3m29s [root@k8s-master ~]# kubectl get pods -o wide NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES myweb-j78ct 1/1 Running 1 45h 10.244.1.5 k8s-node1 <none> <none> myweb-vhxx9 1/1 Running 1 45h 10.244.2.3 k8s-node2 <none> <none> tomcat-deployment-84ff9bf6b4-2f5cc 1/1 Running 0 3m49s 10.244.2.5 k8s-node2 <none> <none> tomcat-deployment-84ff9bf6b4-7g26m 1/1 Running 0 3m49s 10.244.0.11 k8s-master <none> <none> tomcat-deployment-84ff9bf6b4-qptr7 1/1 Running 0 3m49s 10.244.1.6 k8s-node1 <none> <none> [root@k8s-master ~]# curl 10.244.1.6:8080 <!doctype html><html lang="en"><head><title>HTTP Status 404 – Not Found</title><style type="text/css">body {font-family:Tahoma,Arial,sans-serif;} h1, h2, h3, b {color:white;background-color:#525D76;} h1 {font-size:22px;} h2 {font-size:16px;} h3 {font-size:14px;} p {font-size:12px;} a {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>HTTP Status 404 – Not Found</h1><hr class="line" /><p><b>Type</b> Status Report</p><p><b>Description</b> The origin server did not find a current representation for the target resource or is </pre> ==创建service提供外部访问== <pre> cat tomcat-service.yaml apiVersion: v1 kind: Service metadata: name: tomcat-service spec: type: NodePort ports: - port: 8080 targetPort: 8080 nodePort: 30080 selector: app: tomcat kubectl apply -f tomcat-service.yaml # kubectl get service NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 2d3h myweb-vhxx9 NodePort 10.110.242.197 <none> 8080:31747/TCP 45h nginx-pod NodePort 10.97.117.84 <none> 80:32026/TCP 2d3h tomcat-service NodePort 10.97.228.221 <none> 8080:30080/TCP 10m [root@k8s-master ~]# visat mastip + 30080 http://192.168.10.158:30080/ </pre> <pre> </pre> =R= [[K8s部署tomcat mysql 与ingress暴露服务#tomcat]] [https://www.jianshu.com/p/26d25939eadf 四、k8s部署tomcat] [[category:k8s]]
返回至
How to Deploy Tomcat on k8s
。
导航菜单
个人工具
登录
名字空间
页面
讨论
变种
视图
阅读
查看源代码
查看历史
更多
搜索
导航
首页
我的导航
关于我
shell
python
ops
linuxchina.net
blog.linuxchina
最近更改
随机页面
帮助
工具
链入页面
相关更改
特殊页面
页面信息