Advertisement
mitrakov

Config map example

Sep 1st, 2020
1,566
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 0.85 KB | None | 0 0
  1. ## config-map.yaml
  2. apiVersion: v1
  3. kind: ConfigMap
  4. metadata:
  5.   name: nginx-config
  6. data:
  7.   default.conf: |
  8.    server {
  9.       listen 80;
  10.       listen [::]:80;
  11.       server_name  _;
  12.       location / {
  13.         add_header Content-Type text/plain;
  14.         return 200 "Hello world!";
  15.       }
  16.     }
  17.  
  18. ## deployment.yaml
  19. apiVersion: apps/v1
  20. kind: Deployment
  21. metadata:
  22.   labels:
  23.     app: nginx
  24.   name: nginx
  25. spec:
  26.   replicas: 1
  27.   selector:
  28.     matchLabels:
  29.       app: nginx
  30.   template:
  31.     metadata:
  32.       labels:
  33.         app: nginx
  34.     spec:
  35.       containers:
  36.       - name: nginx
  37.         image: nginx
  38.         ports:
  39.         - containerPort: 80
  40.         volumeMounts:
  41.         - name: nginx-configs
  42.           mountPath: /etc/nginx/conf.d
  43.       volumes:
  44.         - name: nginx-configs
  45.           configMap:
  46.             name: nginx-config
  47.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement