Skip to content

Instantly share code, notes, and snippets.

@kocolosk
Created October 6, 2016 23:09
Show Gist options
  • Save kocolosk/c58d69ae055a127ceaec232a9fe63852 to your computer and use it in GitHub Desktop.
Save kocolosk/c58d69ae055a127ceaec232a9fe63852 to your computer and use it in GitHub Desktop.
CouchDB Kubernetes Pet Set
kind: ConfigMap
apiVersion: v1
metadata:
name: couchdb
data:
# Erlang VM settings. The -name flag activates the Erlang distribution; there
# should be no reason to change this setting. The -setcookie flag is used to
# control the Erlang magic cookie. CouchDB cluster nodes can only establish a
# connection with one another if they share the same magic cookie.
erlflags: >
-name couchdb
-setcookie macadamia
# CouchDB server setttings. The UUID is employed in replication checkpoints
# and should be for unique for each cluster, but shared by all members of a
# cluster.
kubernetes.ini: |
[couchdb]
uuid = changeme
[admins]
admin = changeme
# Ensures individual Pets get their own DNS entries
apiVersion: v1
kind: Service
metadata:
labels:
app: couchdb
name: couchdb
namespace: default
spec:
clusterIP: None
ports:
- name: couchdb
port: 5984
selector:
app: couchdb
apiVersion: "apps/v1alpha1"
kind: PetSet
metadata:
name: couchdb
spec:
serviceName: couchdb
replicas: 3
template:
metadata:
annotations:
pod.alpha.kubernetes.io/initialized: "true"
labels:
app: couchdb
spec:
containers:
- name: couchdb
image: klaemo/couchdb:2.0.0
env:
- name: ERL_FLAGS
valueFrom:
configMapKeyRef:
name: couchdb
key: erlflags
ports:
- containerPort: 5984
name: couchdb
- containerPort: 4369
name: epmd
- containerPort: 9100
name: erlang-dist
volumeMounts:
- mountPath: /opt/couchdb/etc/default.d
name: defaultd
- name: couchdb-readiness
image: glyndwr/kube-couchdb-readiness
env:
- name: POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: CLUSTER_ADM_USER
valueFrom:
secretKeyRef:
name: cluster-adm
key: username
- name: CLUSTER_ADM_PASS
valueFrom:
secretKeyRef:
name: cluster-adm
key: password
readinessProbe:
exec:
command:
- /bin/bash
- -c
- ./join_cluster.py _users
initialDelaySeconds: 15
timeoutSeconds: 5
volumes:
- name: defaultd
configMap:
name: couchdb
items:
- key: kubernetes.ini
path: kubernetes.ini
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment