zoukankan      html  css  js  c++  java
  • [k8s]subpath解决cm覆盖目录问题

    参考

    发现cm老覆盖容器原有目录里的内容,后来不得不通过in -s的方式来搞cm, 先将cm挂到/tmp下,然后ln -s文件到指定目录.

    后来发现个cm的subpath特性可以解决这个问题

    写了busybox的cm和rc测试cm subpath

    cat > busybox-cm.yaml <<EOF
    apiVersion: v1
    kind: ConfigMap
    metadata:
      name: busybox-cm
      labels:
          addonmanager.kubernetes.io/mode: EnsureExists
    data:
      Corefile: |
        .:53 {
            errors
            log stdout
            health
            kubernetes cluster.local 172.21.0.0/16
            prometheus
            proxy . /etc/resolv.conf
            cache 30
        }
    EOF
    
    cat > busybox.yaml <<EOF
    apiVersion: v1
    kind: ReplicationController
    metadata:
      name: busybox-cm
      labels:
        app: busybox-cm
    spec:
      replicas: 1
      selector:
        app: busybox-cm
      template:
        metadata:
          name: busybox-cm
          labels:
            app: busybox-cm
        spec:
          containers:
          - image: busybox
            command:
              - sleep
              - "3600"
            imagePullPolicy: IfNotPresent
            name: busybox
            volumeMounts:
            - name: config-volume
              mountPath: /usr/Corefile
              subPath: Corefile
          restartPolicy: Always
          volumes:
            - name: config-volume
              configMap:
                name: busybox-cm
                items:
                - key: Corefile
                  path: Corefile
    EOF
    

  • 相关阅读:
    HTML5新增标签和属性
    HTML——表单标签
    HTML——表格标签
    js
    js
    js
    js
    js-02-2
    js
    selleck --手机端-- 销售打卡记录下载
  • 原文地址:https://www.cnblogs.com/iiiiher/p/8352579.html
Copyright © 2011-2022 走看看