apiVersion: v1 kind: Service metadata: name: nginx-gluster namespace: default labels: name: nginx-gluster spec: type: ClusterIP ports: - port: 80 targetPort: 80 protocol: TCP selector: # This needs to match the selector in the RC/Deployment app: nginx-gluster --- apiVersion: extensions/v1beta1 kind: Deployment metadata: name: nginx-gluster namespace: default labels: app: nginx-gluster spec: revisionHistoryLimit: 0 replicas: 2 selector: matchLabels: app: nginx-gluster strategy: type: RollingUpdate rollingUpdate: maxUnavailable: 0 maxSurge: 1 template: metadata: labels: app: nginx-gluster tier: frontend spec: containers: - name: nginx-gluster image: gcr.io/google_containers/nginx-slim:0.8 imagePullPolicy: IfNotPresent ports: - containerPort: 80 name: nginx-gluster resources: limits: cpu: "100m" memory: 256Mi requests: cpu: "10m" memory: 64Mi readinessProbe: successThreshold: 1 failureThreshold: 2 periodSeconds: 5 initialDelaySeconds: 5 httpGet: path: / port: 80 scheme: HTTP livenessProbe: successThreshold: 1 failureThreshold: 2 periodSeconds: 5 initialDelaySeconds: 5 timeoutSeconds: 1 httpGet: path: / port: 80 scheme: HTTP lifecycle: preStop: exec: command: ["sleep", "5"] securityContext: privileged: true volumeMounts: - name: gluster-vol1 mountPath: /usr/share/nginx/html volumes: - name: gluster-vol1 persistentVolumeClaim: claimName: gluster-dyn-pvc dnsPolicy: ClusterFirst restartPolicy: Always terminationGracePeriodSeconds: 30