Kubernetes configMap - only one file

后端 未结 3 606
星月不相逢
星月不相逢 2021-02-05 08:00

I have a configMap created from file:

kubectl create configmap ssportal-apache-conf --from-file=ssportal.conf=ssportal.conf

and th

3条回答
  •  遇见更好的自我
    2021-02-05 08:27

    Okay, it's a bit tricky. The final working YAML spec is

    apiVersion: extensions/v1beta1
    kind: Deployment
    metadata:
      name: ssportal
    spec:
      replicas: 2
      template:
        metadata:
          labels:
            app: ssportal
        spec:
          containers:
            - name: ssportal
              image: eu.gcr.io/my-project/ssportal:0.0.0
              command: ["sleep","120d"]
              ports:
              - containerPort: 80
              volumeMounts:
                - name: test
                  mountPath: /etc/apache2/conf-enabled/test.conf
                  subPath: test.conf
          volumes:
            - name: test
              configMap:
                name: sstest
    

    and configMap creation steps:

    echo "# comment" > test.conf
    kubectl create configmap sstest --from-file=test.conf=test.conf 
    

提交回复
热议问题