apiVersion: v1 kind: ConfigMap metadata: name: nginx data: nginx.conf: | worker_processes 5; events { } http { # This is the main site. server { listen 80 default_server; default_type text/plain; location / { return 200 "Hostname: $hostname\nUser: $remote_user\nProtocol: $server_protocol\nMethod: $request_method\nPath: $request_uri\nServer: $server_addr\nHttp_host: $http_host\nuser_agent: $http_user_agent\nRemote IP: $remote_addr\n"; } location = /healthz { add_header Content-Type text/plain; return 200 'ok'; } } } --- apiVersion: apps/v1 kind: Deployment metadata: name: demo-app labels: app: demo-app spec: replicas: 1 selector: matchLabels: app: demo-app template: metadata: labels: app: demo-app spec: containers: - name: demo-app image: ubuntu/nginx imagePullPolicy: IfNotPresent ports: - name: http containerPort: 80 volumeMounts: - name: nginx mountPath: /etc/nginx readOnly: true volumes: - name: nginx configMap: name: nginx --- apiVersion: v1 kind: Service metadata: name: demo-app labels: app: demo-app spec: ports: - port: 80 targetPort: 80 protocol: TCP name: tcp selector: app: demo-app