一个pod创建两个容器实例
root@k8s-node1 test]# cat nginx_tomcat.yamlapiVersion: apps/v1beta2kind: Deploymentmetadata:name: demon-podspec:replicas: 1selector:matchLabels:app: testtemplate:meta...
·
root@k8s-node1 test]# cat nginx_tomcat.yaml
apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: tomcat-nginx-pod
spec:
replicas: 1
selector:
matchLabels:
app: test
template:
metadata:
labels:
app: test
spec:
containers:
- name: nginx
image: daocloud.io/library/nginx:1.13.0-alpine
imagePullPolicy: IfNotPresent
ports:
- containerPort: 80
- name: tomcat
image: daocloud.io/library/tomcat:8.5.21-jre8-alpine
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8080
---
apiVersion: v1
kind: Service
metadata:
name: tomcat-nginx-svc
spec:
ports:
- port: 80
targetPort: 80
protocol: TCP
name: nginx
- port: 8080
targetPort: 8080
protocol: TCP
name: tomcat
selector:
app: test
type: NodePort
更多推荐
已为社区贡献45条内容
所有评论(0)