Last active
June 8, 2018 02:42
-
-
Save ll911/a8dd9dde4d9f16acdfffd6ab7fcc2c56 to your computer and use it in GitHub Desktop.
cassandra-k8s-statefulset
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
| apiVersion: v1 | |
| kind: Service | |
| metadata: | |
| labels: | |
| app: cassandra | |
| name: cassandra | |
| spec: | |
| clusterIP: None | |
| ports: | |
| - port: 9042 | |
| selector: | |
| app: cassandra | |
| --- | |
| apiVersion: "apps/v1beta1" | |
| kind: StatefulSet | |
| metadata: | |
| name: cassandra | |
| spec: | |
| serviceName: cassandra | |
| replicas: 5 | |
| template: | |
| metadata: | |
| labels: | |
| app: cassandra | |
| spec: | |
| containers: | |
| - name: cassandra | |
| image: cassandra:3.11 | |
| command: | |
| - /docker-entrypoint.sh | |
| - "-R" | |
| imagePullPolicy: Always | |
| ports: | |
| - containerPort: 7000 | |
| name: intra-node | |
| - containerPort: 7001 | |
| name: tls-intra-node | |
| - containerPort: 7199 | |
| name: jmx | |
| - containerPort: 9042 | |
| name: cql | |
| resources: | |
| limits: | |
| cpu: "500m" | |
| memory: 1Gi | |
| requests: | |
| cpu: "500m" | |
| memory: 1Gi | |
| lifecycle: | |
| preStop: | |
| exec: | |
| command: ["/bin/sh", "-c", "nodetool drain"] | |
| env: | |
| - name: MAX_HEAP_SIZE | |
| value: 512M | |
| - name: HEAP_NEWSIZE | |
| value: 100M | |
| - name: CASSANDRA_LISTEN_ADDRESS | |
| valueFrom: | |
| fieldRef: | |
| fieldPath: status.podIP | |
| - name: CASSANDRA_SEEDS | |
| value: cassandra-0.cassandra | |
| - name: CASSANDRA_CLUSTER_NAME | |
| value: "k8s" | |
| - name: CASSANDRA_DC | |
| value: "DC1" | |
| - name: CASSANDRA_RACK | |
| value: "Rack1" | |
| - name: CASSANDRA_ENDPOINT_SNITCH | |
| value: "GossipingPropertyFileSnitch" | |
| # These volume mounts are persistent. They are like inline claims, | |
| # but not exactly because the names need to match exactly one of | |
| # the stateful pod volumes. | |
| volumeMounts: | |
| - name: cassandra-data | |
| mountPath: /var/lib/cassandra | |
| - name: cassandra-logs | |
| mountPath: /var/log/cassandra | |
| volumes: | |
| - name: cassandra-logs | |
| emptyDir: {} | |
| # These are converted to volume claims by the controller | |
| # and mounted at the paths mentioned above. | |
| # do not use these in production until ssd GCEPersistentDisk or other ssd pd | |
| volumeClaimTemplates: | |
| - metadata: | |
| name: cassandra-data | |
| annotations: | |
| spec: | |
| accessModes: [ "ReadWriteOnce" ] | |
| resources: | |
| requests: | |
| storage: 1Gi | |
| --- | |
| apiVersion: batch/v1 | |
| kind: Job | |
| metadata: | |
| name: kong-migration | |
| spec: | |
| template: | |
| metadata: | |
| name: kong-migration | |
| spec: | |
| containers: | |
| - name: kong-migration | |
| image: kong | |
| env: | |
| - name: KONG_NGINX_DAEMON | |
| value: 'off' | |
| - name: KONG_DATABASE | |
| value: cassandra | |
| - name: KONG_CASSANDRA_CONTACT_POINTS | |
| value: cassandra | |
| - name: KONG_CASSANDRA_KEYSPACE | |
| value: kong | |
| command: [ "/bin/sh", "-c", "kong migrations up" ] | |
| restartPolicy: Never |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment