# Config Map

When we would like to add the env variable to `Pod` , we can do it by add the property called env in `definition file` <br>

```yaml
# Pod Template
apiVersion: v1
kind: Pod
metadata:
  name: nginx
spec:
  containers:
  - name: nginx
    image: nginx:1.14.2
    ports:
    - containerPort: 80
    env:
      - name:
        value:   
      - name:
        value:
    # For ConfigMap case (1)
      - name: APP_COLOR
        valueFrom: 
          configMapRef:
            name: app-config
            key: APP_COLOR  
    # For ConfigMap case (2)
    envFrom:
      - configMapRef:
          name:
    # For ConfigMap case (3)
    volumes:
    - name: app-config-volume
      configMap:
        name: app-config               
```

but It's hard to manage in the configuration in `definition file`  so we have `Config map`  for managing the configuration&#x20;

**CheatSheet**

1. Create Configmap (Imperative way):&#x20;

* `kubectl create configmap <config_name> --from-literal=<key>=<value>`
* `kubectl create configmap <config_name> --from-file=<path_to_file>`

2. Create Configmap (Declarative way):&#x20;

```yaml
# Configmap Template
apiVersion: v1
kind: ConfigMap
metadata:
  name: <configmap_name>
data:
  <key>: <value>
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://dev7days.gitbook.io/dev7days/config-map.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
