ArangoDB init container fails on minikube ArangoDB init container fails on minikube kubernetes kubernetes

ArangoDB init container fails on minikube


The issue was that for those times the init container failed to connect to ArangoDB, the env variables were not correctly set. Therefore, I added another init container before that (since init containers are executed in sequence), that'd wait for the corresponding kubernetes "service" resource of the ArangoDB deployment to come up. That way, by the time the second init container would run, the env variables would be available.

The corresponding portion of kubernetes deployment YAML is shown as:

  apiVersion: apps/v1  kind: Deployment  metadata:    name: carservice  template:    spec:      initContainers:        - name:init-db-service          image: busybox:1.28          command: ['sh', '-c', 'until nslookup carservice-carservicedb; do echo waiting for kubernetes service resource for db; sleep 2; done;']        - name: init-carservice          image: arangodb/arangodb:3.5.1          command: ['sh', 'c', 'arangosh --server.endpoint="https://${CARSERVICE_CARSERVICEDB_SERVICE_HOST}:${CARSERVICE_CARSERVICEDB_SERVICE_PORT}" --server.password=""; do echo waiting for database to be up; sleep 2; done;']      containers:        - name: carservice          image: carservice          imagePullPolicy: IfNotPresent