Container
Einstellungen eines Containers. Gehören in einen Container- oder Init-Container-Klammerblock.
| Block | Art | Platz |
|---|---|---|
| Image … | Stapel | in einen "Container"-Block |
| Port … Name … … | Stapel | in einen "Container"-Block |
| Variable … = … | Stapel | in einen "Container"-Block |
| Variable … aus … … Schlüssel … | Stapel | in einen "Container"-Block |
| alle Variablen aus … … | Stapel | in einen "Container"-Block |
| … CPU … RAM … | Stapel | in einen "Container"-Block |
| Volume … einhängen in … nur lesen … | Stapel | in einen "Container"-Block |
| Command … | Stapel | in einen "Container"-Block |
| Argumente … | Stapel | in einen "Container"-Block |
| Image laden … | Stapel | in einen "Container"-Block |
| Arbeitsordner … | Stapel | in einen "Container"-Block |
| … prüfen per … Pfad … Port … nach … s alle … s | Stapel | in einen "Container"-Block |
| sicher: keine Rechte-Ausweitung … Root-FS nur lesen … alle Capabilities weg … | Stapel | in einen "Container"-Block |
Image …
Stapelblock · Typ-ID c_image · gehört in einen "Container"-Block
| # | Feld | Art | Standard | Auswahl |
|---|---|---|---|---|
| 1 | IMAGE | Text | image-registry.openshift-image-registry.svc:5000/demo-project/demo-app:latest |
Erzeugtes YAML mit Standardwerten
apiVersion: apps/v1
kind: Deployment
metadata:
name: demo
spec:
replicas: 1
selector:
matchLabels:
app: demo
template:
metadata:
labels:
app: demo
spec:
containers:
- name: app
image: image-registry.openshift-image-registry.svc:5000/demo-project/demo-app:latest
Port … Name … …
Stapelblock · Typ-ID c_port · gehört in einen "Container"-Block
| # | Feld | Art | Standard | Auswahl |
|---|---|---|---|---|
| 1 | PORT | Zahl | 8080 | |
| 2 | NAME | Text | (leer) | |
| 3 | PROTO | Auswahl | TCP | TCP, UDP, SCTP |
Erzeugtes YAML mit Standardwerten
apiVersion: apps/v1
kind: Deployment
metadata:
name: demo
spec:
replicas: 1
selector:
matchLabels:
app: demo
template:
metadata:
labels:
app: demo
spec:
containers:
- name: app
image: nginx:latest
ports:
- containerPort: 8080
Variable … = …
Stapelblock · Typ-ID c_env · gehört in einen "Container"-Block
| # | Feld | Art | Standard | Auswahl |
|---|---|---|---|---|
| 1 | K | Text | LOG_LEVEL | |
| 2 | V | Text | info |
Erzeugtes YAML mit Standardwerten
apiVersion: apps/v1
kind: Deployment
metadata:
name: demo
spec:
replicas: 1
selector:
matchLabels:
app: demo
template:
metadata:
labels:
app: demo
spec:
containers:
- name: app
image: nginx:latest
env:
- name: LOG_LEVEL
value: info
Variable … aus … … Schlüssel …
Stapelblock · Typ-ID c_env_ref · gehört in einen "Container"-Block
| # | Feld | Art | Standard | Auswahl |
|---|---|---|---|---|
| 1 | K | Text | DB_PASSWORD | |
| 2 | SRC | Auswahl | Secret | Secret → secretKeyRef, ConfigMap → configMapKeyRef |
| 3 | NAME | Text | demo-app-secret | |
| 4 | KEY | Text | DB_PASSWORD |
Erzeugtes YAML mit Standardwerten
apiVersion: apps/v1
kind: Deployment
metadata:
name: demo
spec:
replicas: 1
selector:
matchLabels:
app: demo
template:
metadata:
labels:
app: demo
spec:
containers:
- name: app
image: nginx:latest
env:
- name: DB_PASSWORD
valueFrom:
secretKeyRef:
name: demo-app-secret
key: DB_PASSWORD
alle Variablen aus … …
Stapelblock · Typ-ID c_env_from · gehört in einen "Container"-Block
| # | Feld | Art | Standard | Auswahl |
|---|---|---|---|---|
| 1 | SRC | Auswahl | ConfigMap | ConfigMap → configMapRef, Secret → secretRef |
| 2 | NAME | Text | demo-app-config |
Erzeugtes YAML mit Standardwerten
apiVersion: apps/v1
kind: Deployment
metadata:
name: demo
spec:
replicas: 1
selector:
matchLabels:
app: demo
template:
metadata:
labels:
app: demo
spec:
containers:
- name: app
image: nginx:latest
envFrom:
- configMapRef:
name: demo-app-config
… CPU … RAM …
Stapelblock · Typ-ID c_resources · gehört in einen "Container"-Block
| # | Feld | Art | Standard | Auswahl |
|---|---|---|---|---|
| 1 | KIND | Auswahl | mindestens (requests) | mindestens (requests) → requests, höchstens (limits) → limits |
| 2 | CPU | Text | 100m | |
| 3 | MEM | Text | 128Mi |
Erzeugtes YAML mit Standardwerten
apiVersion: apps/v1
kind: Deployment
metadata:
name: demo
spec:
replicas: 1
selector:
matchLabels:
app: demo
template:
metadata:
labels:
app: demo
spec:
containers:
- name: app
image: nginx:latest
resources:
requests:
cpu: 100m
memory: 128Mi
Volume … einhängen in … nur lesen …
Stapelblock · Typ-ID c_mount · gehört in einen "Container"-Block
| # | Feld | Art | Standard | Auswahl |
|---|---|---|---|---|
| 1 | NAME | Text | data | |
| 2 | PATH | Text | /data | |
| 3 | RO | Häkchen | aus |
Erzeugtes YAML mit Standardwerten
apiVersion: apps/v1
kind: Deployment
metadata:
name: demo
spec:
replicas: 1
selector:
matchLabels:
app: demo
template:
metadata:
labels:
app: demo
spec:
containers:
- name: app
image: nginx:latest
volumeMounts:
- name: data
mountPath: /data
Command …
Stapelblock · Typ-ID c_command · gehört in einen "Container"-Block
| # | Feld | Art | Standard | Auswahl |
|---|---|---|---|---|
| 1 | CMD | Text | /bin/sh -c "echo hallo" |
Erzeugtes YAML mit Standardwerten
apiVersion: apps/v1
kind: Deployment
metadata:
name: demo
spec:
replicas: 1
selector:
matchLabels:
app: demo
template:
metadata:
labels:
app: demo
spec:
containers:
- name: app
image: nginx:latest
command:
- /bin/sh
- -c
- echo hallo
Argumente …
Stapelblock · Typ-ID c_args · gehört in einen "Container"-Block
| # | Feld | Art | Standard | Auswahl |
|---|---|---|---|---|
| 1 | ARGS | Text | --port 8080 |
Erzeugtes YAML mit Standardwerten
apiVersion: apps/v1
kind: Deployment
metadata:
name: demo
spec:
replicas: 1
selector:
matchLabels:
app: demo
template:
metadata:
labels:
app: demo
spec:
containers:
- name: app
image: nginx:latest
args:
- --port
- "8080"
Image laden …
Stapelblock · Typ-ID c_pull · gehört in einen "Container"-Block
| # | Feld | Art | Standard | Auswahl |
|---|---|---|---|---|
| 1 | P | Auswahl | IfNotPresent | IfNotPresent, Always, Never |
Erzeugtes YAML mit Standardwerten
apiVersion: apps/v1
kind: Deployment
metadata:
name: demo
spec:
replicas: 1
selector:
matchLabels:
app: demo
template:
metadata:
labels:
app: demo
spec:
containers:
- name: app
image: nginx:latest
imagePullPolicy: IfNotPresent
Arbeitsordner …
Stapelblock · Typ-ID c_workdir · gehört in einen "Container"-Block
| # | Feld | Art | Standard | Auswahl |
|---|---|---|---|---|
| 1 | DIR | Text | /app |
Erzeugtes YAML mit Standardwerten
apiVersion: apps/v1
kind: Deployment
metadata:
name: demo
spec:
replicas: 1
selector:
matchLabels:
app: demo
template:
metadata:
labels:
app: demo
spec:
containers:
- name: app
image: nginx:latest
workingDir: /app
… prüfen per … Pfad … Port … nach … s alle … s
Stapelblock · Typ-ID c_probe · gehört in einen "Container"-Block
| # | Feld | Art | Standard | Auswahl |
|---|---|---|---|---|
| 1 | KIND | Auswahl | Lebt? (liveness) | Lebt? (liveness) → livenessProbe, Bereit? (readiness) → readinessProbe, Gestartet? (startup) → startupProbe |
| 2 | HOW | Auswahl | HTTP GET | HTTP GET → http, TCP → tcp |
| 3 | PATH | Text | /healthz | |
| 4 | PORT | Text | 8080 | |
| 5 | DELAY | Zahl | 5 | |
| 6 | PERIOD | Zahl | 10 |
Erzeugtes YAML mit Standardwerten
apiVersion: apps/v1
kind: Deployment
metadata:
name: demo
spec:
replicas: 1
selector:
matchLabels:
app: demo
template:
metadata:
labels:
app: demo
spec:
containers:
- name: app
image: nginx:latest
livenessProbe:
httpGet:
path: /healthz
port: 8080
initialDelaySeconds: 5
periodSeconds: 10
sicher: keine Rechte-Ausweitung … Root-FS nur lesen … alle Capabilities weg …
Stapelblock · Typ-ID c_security · gehört in einen "Container"-Block
| # | Feld | Art | Standard | Auswahl |
|---|---|---|---|---|
| 1 | NOESC | Häkchen | an | |
| 2 | ROFS | Häkchen | aus | |
| 3 | DROP | Häkchen | an |
Erzeugtes YAML mit Standardwerten
apiVersion: apps/v1
kind: Deployment
metadata:
name: demo
spec:
replicas: 1
selector:
matchLabels:
app: demo
template:
metadata:
labels:
app: demo
spec:
containers:
- name: app
image: nginx:latest
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL