meta data de esta página
Diferencias
Muestra las diferencias entre dos versiones de la página.
Ambos lados, revisión anteriorRevisión previaPróxima revisión | Revisión previa | ||
virtualizacion:kubernetes:configmap [2020/11/05 20:48] – lc | virtualizacion:kubernetes:configmap [2023/01/18 14:37] (actual) – editor externo 127.0.0.1 | ||
---|---|---|---|
Línea 59: | Línea 59: | ||
- key: nginx | - key: nginx | ||
path: default.conf | path: default.conf | ||
- | </ | + | </ |
- | + | Ejemplo con variables y volúmenes | |
- | ==== Referencias ==== | + | <sxh yaml> |
+ | apiVersion: v1 | ||
+ | kind: ConfigMap | ||
+ | metadata: | ||
+ | name: nginx-config | ||
+ | labels: | ||
+ | app: front | ||
+ | data: | ||
+ | nginx: | # | ||
+ | server { | ||
+ | listen | ||
+ | server_name | ||
+ | location / { | ||
+ | root | ||
+ | index index.html index.htm; | ||
+ | } | ||
+ | error_page | ||
+ | location = /50x.html { | ||
+ | root / | ||
+ | } | ||
+ | } | ||
+ | --- | ||
+ | apiVersion: v1 | ||
+ | kind: ConfigMap | ||
+ | metadata: | ||
+ | name: vars | ||
+ | labels: | ||
+ | app: front | ||
+ | data: # | ||
+ | db_host: dev.host.local | ||
+ | db_user: dev_user | ||
+ | script: | # | ||
+ | echo DB host es $DB_HOST y DB user es $DB_USER > / | ||
+ | --- | ||
+ | apiVersion: apps/v1 | ||
+ | kind: Deployment | ||
+ | metadata: | ||
+ | name: deployment-test | ||
+ | labels: | ||
+ | app: front | ||
+ | spec: | ||
+ | replicas: 1 | ||
+ | selector: | ||
+ | matchLabels: | ||
+ | app: front | ||
+ | template: | ||
+ | metadata: | ||
+ | labels: | ||
+ | app: front | ||
+ | spec: | ||
+ | containers: | ||
+ | - name: nginx | ||
+ | image: nginx: | ||
+ | env: | ||
+ | - name: DB_HOST | ||
+ | valueFrom: | ||
+ | configMapKeyRef: | ||
+ | name: vars | ||
+ | key: db_host | ||
+ | - name: DB_USER | ||
+ | valueFrom: | ||
+ | configMapKeyRef: | ||
+ | name: vars | ||
+ | key: db_user | ||
+ | volumeMounts: | ||
+ | - name: nginx-vol | ||
+ | mountPath: / | ||
+ | - name: script-vol | ||
+ | mountPath: /opt | ||
+ | volumes: | ||
+ | - name: nginx-vol | ||
+ | configMap: | ||
+ | name: nginx-config | ||
+ | items: | ||
+ | - key: nginx | ||
+ | path: default.conf | ||
+ | - name: script-vol | ||
+ | configMap: | ||
+ | name: vars | ||
+ | items: | ||
+ | - key: script | ||
+ | path: script.sh | ||
+ | </ | ||
+ | ==== Referencias ==== | ||
* https:// | * https:// | ||
* https:// | * https:// |