“How to Deploy Tomcat on k8s”的版本间的差异

来自linux中国网wiki
跳到导航 跳到搜索
第1行: 第1行:
k8s部署tomcat
+
=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>
 +
 +
</pre>
 +
 +
 +
 +
<pre>
 +
 +
</pre>
 +
 +
 +
<pre>
 +
 +
</pre>
 
=R=
 
=R=
 
[[K8s部署tomcat mysql 与ingress暴露服务#tomcat]]
 
[[K8s部署tomcat mysql 与ingress暴露服务#tomcat]]

2022年6月28日 (二) 11:32的版本

k8s部署tomcat

Deployment

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

具体Deployment编写细节请参考以下地址: https://kubernetes.io/zh/docs/concepts/workloads/controllers/deployment/







R

K8s部署tomcat mysql 与ingress暴露服务#tomcat

四、k8s部署tomcat