K8S在集群节点挂载数据卷

    spec:
      volumes:
        - name: mysql-conf
          hostPath:
            path: /usr/mysql/conf
            type: DirectoryOrCreate
        - name: mysql-data
          hostPath:
            path: /usr/mysql/data
            type: DirectoryOrCreate
        - name: mysql-log
          hostPath:
            path: /usr/mysql/log
            type: DirectoryOrCreate
      containers:
        - name: mysql
          image: '12.16.21.16/hub/mysql:5.7'
          ports:
            - name: mysql
              containerPort: 3306
              protocol: TCP
          env:
            - name: MYSQL_ROOT_HOST
              value: '%'
            - name: MYSQL_ROOT_PASSWORD
              value: pwd
            - name: TZ
              value: Asia/Shanghai
          resources:
            limits:
              memory: 2Gi
            requests:
              memory: 1Gi
          volumeMounts:
            - name: mysql-conf
              mountPath: /etc/mysql
            - name: mysql-data
              mountPath: /var/lib/mysql
            - name: mysql-log
              mountPath: /logs
Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐