yaml清单demo
apiVersion: v1
kind: Pod
metadata:
name: test-pod
namespace: test
labels:
environment: STG
spec:
containers:
- name: my-nginx-container
image: nginx:latest
imagePullPolicy: IfNotPresent
ports:
- name: nginx-port
containerPort: 80
protocol: TCP
- name: mysql
image: mysql:5.7.40
imagePullPolicy: IfNotPresent
ports:
- name: mysql-port
containerPort: 3306
protocol: TCP
env:
- name: "MYSQL_ROOT_PASSWORD"
value: "123456"
---
apiVersion: v1
kind: Service
metadata:
name: svc-nginx
namespace: test
spec:
ports:
- port: 80
protocol: TCP
targetPort: 80
selector:
run: nginx
type: NodePort
---
apiVersion: v1
kind: Service
metadata:
name: svc-mysql
namespace: test
spec:
ports:
- port: 3306
protocol: TCP
targetPort: 3306
selector:
run: mysql
type: NodePort
本文来自博客园,作者:弩哥++,转载请注明原文链接:https://www.cnblogs.com/bangbangzoutianya/p/16831633.html