How to Deploy Tomcat on k8s

来自linux中国网wiki
Evan讨论 | 贡献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