Created
August 7, 2018 12:40
-
-
Save jasonforte/0722fdd1eddd49243a1e3d32fd07b30a to your computer and use it in GitHub Desktop.
Sample statefulset with EBS on EKS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| kind: StorageClass | |
| apiVersion: storage.k8s.io/v1 | |
| metadata: | |
| name: gp2 | |
| provisioner: kubernetes.io/aws-ebs | |
| parameters: | |
| type: gp2 | |
| reclaimPolicy: Retain | |
| mountOptions: | |
| - debug | |
| --- | |
| apiVersion: v1 | |
| kind: Service | |
| metadata: | |
| name: nginx | |
| labels: | |
| app: nginx | |
| spec: | |
| ports: | |
| - port: 80 | |
| name: web | |
| clusterIP: None | |
| selector: | |
| app: nginx | |
| --- | |
| apiVersion: apps/v1beta2 | |
| kind: StatefulSet | |
| metadata: | |
| name: web | |
| spec: | |
| selector: | |
| matchLabels: | |
| app: nginx # Label selector that determines which Pods belong to the StatefulSet | |
| # Must match spec: template: metadata: labels | |
| serviceName: nginx | |
| replicas: 3 | |
| template: | |
| metadata: | |
| labels: | |
| app: nginx # Pod template's label selector | |
| spec: | |
| terminationGracePeriodSeconds: 10 | |
| containers: | |
| - name: nginx | |
| image: nginx | |
| ports: | |
| - containerPort: 80 | |
| name: web | |
| volumeMounts: | |
| - name: www | |
| mountPath: /usr/share/nginx/html | |
| volumeClaimTemplates: | |
| - metadata: | |
| name: www | |
| spec: | |
| storageClassName: gp2 | |
| accessModes: ["ReadWriteOnce"] | |
| resources: | |
| requests: | |
| storage: 1Gi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment