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
posted @ 2022-10-27 11:31  弩哥++  阅读(20)  评论(0编辑  收藏  举报