Config - ConfigMaps Flashcards

1
Q

1.

What are ConfigMaps used for?

A
  • to pass configuration data in the form of key-value pairs in kubernetes
  • when a pod is created, inject the config data into the pod, so that the key-value pairs available as environment variables for the hosted application in the pod
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Which phases are involved in working with ConfigMaps?

A
  • create the configMap
  • Inject into the pod
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How do you create configMaps?

A

Imperative ‘kubectl create configmap …’
Adding the key-value pairs as arguments

‘kubectl create configmap
< config-name> –from-literal=< key>=< value>’

‘kubectl create configmap app-config –from-literal=APP_COLOR=blue’

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How do you create a config-map from a file?

A

‘kubectl create config-map app-config –from-file=app_config.properties’

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the decision where to create a configMap from based on?

A
  • based on the amount of properties to be configured
  • many properties are easier from a file
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How does a declarative configMap look?

A

Yaml file

apiVersion: v1
kind: ConfigMap
metadata:
  name: app-config
data:
  APP_COLOR: blue
	APP_MODE: prod
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How can you view a config map?

A

kubectl get configmaps

kubectl describe configmaps

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How do you use ConfigMaps in pods?

A

in Yaml

spec:
 containers:
   - name:
    image:
		ports:
		  - containerPort: 8080
		 envFrom:
		   - configMapRef:
			     name: app-config
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What options exist in regards to defining config maps in pods?

A
  1. As a single env:
    ~~~
    env:
    - name: APP_COLOR
    valueFrom:
    configMapKeyRef:
    name: app-config
    key: APP_COLOR
    ~~~
  2. whole env:
    ~~~
    envFrom:
    - configMapRef:
    name: app-config
    ~~~
  3. As data in a file / Volume:
    ~~~
    volumes:
    - name: app-config-volume
    configMap:
    name: app-config
    ~~~
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Wie wird configmap abgekürzt?

A

cm

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly