其他分享
首页 > 其他分享> > k8s创建configmap

k8s创建configmap

作者:互联网

1.示例:

vim configmap.yaml

apiVersion: v1
data:
  my.cnf: |
    # The MySQL  Server configuration file.
    [mysqld]
    pid-file        = /var/run/mysqld/mysqld.pid
    socket          = /var/run/mysqld/mysqld.sock
    datadir         = /var/lib/mysql
    #log-bin         = /var/lib/mysql-binlog/mysql-bin
    binlog-format   = ROW
    server_id=1
    secure-file-priv= NULL
    # Disabling symbolic-links is recommended to prevent assorted security risks
    symbolic-links=0
    character_set_server = utf8
    connect_timeout=600
    net_read_timeout=60
    net_write_timeout=600
    skip-name-resolve
    max_connections = 8000
    max_allowed_packet=512M
    lower_case_table_names=1

    # Custom config should go here
    !includedir /etc/mysql/conf.d/
kind: ConfigMap
metadata:
  name: my.cnf
  namespace: fat-s-apollo

2.发布

kubectl apply -f configmap.yaml

3.deployment引用confimap

      volumes:
        - name: localtime
          hostPath: 
            path: /etc/localtime
        - name: my-cnf
          configMap:
            name: my.cnf

 

标签:configmap,name,创建,cnf,mysqld,mysql,var,k8s,my
来源: https://www.cnblogs.com/linjiangCN/p/16329646.html