Created
October 26, 2017 16:17
-
-
Save austbot/0b4a80cd08d6c8376e94a119d4a1f135 to your computer and use it in GitHub Desktop.
Mongo Db as a Statefulset, Kube 1.8
This file contains 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
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: mongo | |
labels: | |
name: mongo | |
spec: | |
ports: | |
- port: 27017 | |
targetPort: 27017 | |
clusterIP: None | |
selector: | |
role: mongo | |
--- | |
apiVersion: apps/v1beta1 | |
kind: StatefulSet | |
metadata: | |
name: mongo | |
spec: | |
serviceName: "mongo" | |
updateStrategy: | |
type: RollingUpdate | |
replicas: 3 | |
template: | |
metadata: | |
labels: | |
role: "mongo" | |
environment: development | |
spec: | |
terminationGracePeriodSeconds: 10 | |
containers: | |
- name: mongo | |
image: mongo | |
command: | |
- mongod | |
- "--replSet" | |
- rs0 | |
- "--smallfiles" | |
- "--noprealloc" | |
ports: | |
- containerPort: 27017 | |
volumeMounts: | |
- name: mongo-persistent-storage | |
mountPath: /data/db | |
- name: proposal-mongo-sidecar | |
image: austbot/mongo-k8s-sidecar | |
env: | |
- name: KUBERNETES_MONGO_SERVICE_NAME | |
value: "mongo" | |
- name: MONGO_SIDECAR_POD_LABELS | |
value: "role=mongo,environment=development" | |
volumeClaimTemplates: | |
- metadata: | |
name: mongo-persistent-storage | |
annotations: | |
volume.beta.kubernetes.io/storage-class: aws-efs | |
spec: | |
accessModes: [ "ReadWriteOnce" ] | |
resources: | |
requests: | |
storage: 1Mi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment