您的位置 首页 k8s

一个pod 内运行多个容器案例

一个pod 内运行多个容器案例

 

apiVersion: v1
kind: Pod
metadata:
  name: baimei-ports-02
spec:
  # hostNetwork: true
  nodeName: worker233
  containers: 
  - name: db
    image: harbor.baimei.com/baimei-db/mysql:5.7
    # 指定pod的端口映射信息
    ports:
      # 容器的端口号
    - containerPort: 3306
      # 容器绑定到宿主机的IP地址,若不写表示"0.0.0.0"
      hostIP: 10.0.0.233
      # 映射的主机端口
      hostPort: 13306
      # 给服务起名字,要求唯一
      name: db
      # 指定协议
      protocol: TCP
    #- containerPort: 80
    #  hostIP: 10.0.0.233
    #  hostPort: 18080
    #  name: wp
    env:
    - name: MYSQL_ALLOW_EMPTY_PASSWORD
      value: "yes"
    - name: MYSQL_DATABASE
      value: "wordpress"
    - name: MYSQL_USER
      value: "admin"
    - name: MYSQL_PASSWORD
      value: "baimei"
  - name: wp
    image: harbor.baimei.com/baimei-wordpress/wordpress:latest
    env:
    - name: WORDPRESS_DB_HOST
      value: "127.0.0.1"
    - name: WORDPRESS_DB_USER
      value: "admin"
    - name: WORDPRESS_DB_PASSWORD
      value: "baimei"
    - name: WORDPRESS_DB_NAME
      value: "wordpress"
    ports:
    - containerPort: 80
      hostIP: 10.0.0.233
      hostPort: 18080
      name: wp

 

具体部署: 参考 :连接

 

 

欢迎来撩 : 汇总all

白眉大叔

关于白眉大叔linux云计算: 白眉大叔

热门文章