foundationdb/fdbkubernetesmonitor
John Brownlee ee292e2df7 Update based on PR feedback. 2021-10-28 17:40:05 -07:00
..
.testdata Add an option to load an additional file of environment variables in fdb-kubernetes-monitor. 2021-10-28 17:40:05 -07:00
README.md Move the new Kubernetes image to centos 7. 2021-10-28 17:40:05 -07:00
config.go Update based on PR feedback. 2021-10-28 17:40:05 -07:00
config_test.go Add the init and sidecar modes for fdb-kubernetes-monitor. 2021-10-28 17:40:05 -07:00
copy.go Update based on PR feedback. 2021-10-28 17:40:05 -07:00
go.mod Adds structured logging in fdb-kubernetes-monitor. 2021-10-28 17:40:05 -07:00
go.sum Adds structured logging in fdb-kubernetes-monitor. 2021-10-28 17:40:05 -07:00
kubernetes.go Adds structured logging in fdb-kubernetes-monitor. 2021-10-28 17:40:05 -07:00
main.go Move the new Kubernetes image to centos 7. 2021-10-28 17:40:05 -07:00
monitor.go Move the new Kubernetes image to centos 7. 2021-10-28 17:40:05 -07:00

README.md

This package provides a launcher program for running FoundationDB in Kubernetes.

To test this, run the following commands from the root of the FoundationDB repository:

docker build -t foundationdb/foundationdb-kubernetes:6.3.13-local --build-arg FDB_VERSION=6.3.13 --build-arg FDB_LIBRARY_VERSIONS="6.3.13 6.2.30 6.1.13" -f packaging/docker/kubernetes/Dockerfile .
docker build -t foundationdb/foundationdb-kubernetes:6.3.15-local --build-arg FDB_VERSION=6.3.15 --build-arg FDB_LIBRARY_VERSIONS="6.3.15 6.2.30 6.1.13" -f packaging/docker/kubernetes/Dockerfile .
kubectl apply -f packaging/docker/kubernetes/test_config.yaml
# Wait for the pods to become ready
ips=$(kubectl get pod -l app=fdb-kubernetes-example -o json | jq -j '[[.items|.[]|select(.status.podIP!="")]|limit(3;.[])|.status.podIP+":4501"]|join(",")')
sed -e "s/fdb.cluster: \"\"/fdb.cluster: \"test:test@$ips\"/" -e "s/\"serverCount\": 0/\"serverCount\": 1/" packaging/docker/kubernetes/test_config.yaml | kubectl apply -f -
kubectl get pod -l app=fdb-kubernetes-example -o name | xargs -I {} kubectl annotate {} foundationdb.org/outdated-config-map-seen=$(date +%s) --overwrite
# Watch the logs for the fdb-kubernetes-example pods to confirm that they have launched the fdbserver processes.
kubectl exec -it sts/fdb-kubernetes-example -- fdbcli --exec "configure new double ssd"

This will set up a cluster in your Kubernetes environment using a statefulset, to provide a simple subset of what the Kubernetes operator does to set up the cluster. Note: This assumes that you are running Docker Desktop on your local machine, with Kubernetes configured through Docker Desktop.

You can then make changes to the data in the config map and update the fdbserver processes:

sed -e "s/fdb.cluster: \"\"/fdb.cluster: \"test:test@$ips\"/" -e "s/\"serverCount\": 0/\"serverCount\": 1/" packaging/docker/kubernetes/test_config.yaml | kubectl apply -f -

# You can apply an annotation to speed up the propagation of config
kubectl get pod -l app=fdb-kubernetes-example -o name | xargs -I {} kubectl annotate {} foundationdb.org/outdated-config-map-seen=$(date +%s) --overwrite

# Watch the logs for the fdb-kubernetes-example pods to confirm that they have reloaded their configuration, and then do a bounce.
kubectl exec -it sts/fdb-kubernetes-example -- fdbcli --exec "kill; kill all; status"

Once you are done, you can tear down the example with the following command:

kubectl delete -f packaging/docker/kubernetes/test_config.yaml; kubectl delete pvc -l app=fdb-kubernetes-example