Questions tagged [configmap]

ConfigMaps allow you to decouple configuration artifacts from image content to keep containerized applications portable.

ConfigMaps bind configuration files, command-line arguments, environment variables, port numbers, and other configuration artifacts to your Pods' containers and system components at runtime. ConfigMaps allow you to separate your configurations from your Pods and components, which helps keep your workloads portable, makes their configurations easier to change and manage, and prevents hardcoding configuration data to Pod specifications.

ConfigMaps are useful for storing and sharing non-sensitive, unencrypted configuration information. To use sensitive information in your clusters, you must use Secrets.

Documentations

503 questions
238
votes
12 answers

Restart pods when configmap updates in Kubernetes?

How do I automatically restart Kubernetes pods and pods associated with deployments when their configmap is changed/updated? I know there's been talk about the ability to automatically restart pods when a config maps changes but to my knowledge…
Johan
  • 37,479
  • 32
  • 149
  • 237
137
votes
6 answers

Update k8s ConfigMap or Secret without deleting the existing one

I've been using K8S ConfigMap and Secret to manage our properties. My design is pretty simple, that keeps properties files in a git repo and use build server such as Thoughtworks GO to automatically deploy them to be ConfigMaps or Secrets (on choice…
James Jiang
  • 2,073
  • 6
  • 19
  • 25
41
votes
3 answers

Kubernetes - How to define ConfigMap built using a file in a yaml?

At present I am creating a configmap from the file config.json by executing: kubectl create configmap jksconfig --from-file=config.json I would want the ConfigMap to be created as part of the deployment and tried to do this: apiVersion: v1 kind:…
Chillax
  • 4,418
  • 21
  • 56
  • 91
40
votes
1 answer

Override env values defined in container spec

I have a configmap where I have defined the following key-value mapping in the data section: apiVersion: v1 kind: ConfigMap metadata: namespace: test name: test-config data: TEST: "CONFIGMAP_VALUE" then in the definition of my container (in…
asenovm
  • 6,397
  • 2
  • 41
  • 52
39
votes
4 answers

Is there a way to share a configMap in kubernetes between namespaces?

We are using one namespace for the develop environment and one for the staging environment. Inside each one of this namespaces we have several configMaps and secrets but there are a lot of share variables between the two environments so we will like…
Daniseijo
  • 417
  • 1
  • 4
  • 8
39
votes
5 answers

How to patch a ConfigMap in Kubernetes

Kubernetes ships with a ConfigMap called coredns that lets you specify DNS settings. I want to modify or patch a small piece of this configuration by adding: apiVersion: v1 kind: ConfigMap data: upstreamNameservers: | ["1.1.1.1", "1.0.0.1"] I…
Muhammad Rehan Saeed
  • 35,627
  • 39
  • 202
  • 311
34
votes
2 answers

Kubernetes config map symlinks (..data/) : is there a way to avoid them?

I have noticed that when I create and mount a config map that contains some text files, the container will see those files as symlinks to ../data/myfile.txt . For example, if my config map is named tc-configs and contains 2 xml files named…
Anthony Dahanne
  • 4,823
  • 2
  • 40
  • 39
25
votes
2 answers

How to save content of a configmap to a file with kubectl and jsonpath?

I'm trying to save the contents of a configmap to a file on my local hard drive. Kubectl supports selecting with JSONPath but I can't find the expression I need to select just the file contents. The configmap was created using the command kubectl…
PeterH
  • 801
  • 2
  • 7
  • 16
23
votes
1 answer

Custom nginx.conf from ConfigMap in Kubernetes

I have Kubernetes set up in a home lab and I am able to get a vanilla implementation of nginx running from a deployment. The next step is to have a custom nginx.conf file for the configuration of nginx. For this, I am using a ConfigMap. When I do…
Eric
  • 491
  • 3
  • 6
  • 14
23
votes
4 answers

Delete a configmap itself from Kubernetes

I am trying to delete a configmap from a k8s namespace .. i created the configmap using the command below kubectl -n namespacename create -f configmap.yaml checking the k8s cheat sheet https://kubernetes.io/docs/reference/kubectl/cheatsheet/ i…
Hany Habib
  • 1,377
  • 1
  • 10
  • 19
20
votes
2 answers

What is the difference between |+ and |- when creating a configmap from a file in kubernetes yaml definitions?

i've came across 2 types of syntax for creating configmaps from files in kubernetes. first one ; apiVersion: v1 data: file1.yaml: |+ parameter1=value1 kind: ConfigMap metadata: name: my-configmap second one ; apiVersion: v1 data: …
whatmakesyou
  • 251
  • 1
  • 2
  • 6
18
votes
1 answer

When should I use envFrom for configmaps?

According to the Kubernetes docs K8s Docs as of v1.6 and later we are able to use: envFrom: - configMapRef: name: To define all the configMaps data as container env variables. What is the use case for using this versus setting…
humiliatedpenguin
  • 235
  • 1
  • 2
  • 7
17
votes
4 answers

Does Kubernetes take JSON format as input file to create configmap and secret?

I have an existing configuration file in JSON format, something like below { "maxThreadCount": 10, "trackerConfigs": [{ "url": "https://example1.com/", "username": "username", "password": "password", …
user1684651
  • 390
  • 1
  • 8
  • 21
16
votes
2 answers

Kubernetes: How to set boolean type variable in configMap

I want to set a boolean variable in configMap (or secret): apiVersion: v1 kind: ConfigMap metadata: name: env-config namespace: mlo-stage data: webpack_dev_server: false But when I apply it, I get the following error: The request is invalid:…
Ken Tsoi
  • 1,195
  • 1
  • 17
  • 37
16
votes
5 answers

How to import custom dashboards to grafana using helm

I'm trying to understand helm and I wonder if someone could ELI5 to me something or help me with something. So i did run below: helm repo add coreos https://s3-eu-west-1.amazonaws.com/coreos-charts/stable/ Then I installed kube-prometheus by using…
tr53
  • 633
  • 1
  • 7
  • 22
1
2 3
33 34