yurake/k8s-3tier-webapp

View on GitHub
kubernetes/nginx/nginx-deployment.yaml

Summary

Maintainability
Test Coverage
apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx
spec:
  selector:
    matchLabels:
      app: nginx
  replicas: 1
  template:
    metadata:
      labels:
        tier: frontend
        component: web
        app: nginx
      annotations:
        prometheus.io/scrape: "true"
        prometheus.io/port: "9113"
    spec:
      containers:
        - name: nginx
          image: yurak/nginx:latest
          imagePullPolicy: Always
          ports:
            - containerPort: 8080
          livenessProbe:
            tcpSocket:
              port: 8080
          readinessProbe:
            httpGet:
              port: 9113
        - name: nginx-exporter
          image: nginx/nginx-prometheus-exporter:0.11.0
          ports:
            - containerPort: 9113
          env:
            - name: SCRAPE_URI
              value: "http://localhost:80/stub_status"
          livenessProbe:
            tcpSocket:
              port: 9113
          readinessProbe:
            tcpSocket:
              port: 9113