Skip to content

Instantly share code, notes, and snippets.

@atheiman
Last active August 2, 2019 20:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save atheiman/bab73f105ef7fc282f144acee291b7f0 to your computer and use it in GitHub Desktop.
Save atheiman/bab73f105ef7fc282f144acee291b7f0 to your computer and use it in GitHub Desktop.
verify dind (docker in docker) working on each node of a kubernetes cluster

Check the logs of the docker container in each pod of the deploy to verify dind is working on your kubernetes cluster. Pods will restart if they cannot talk to docker server.

apiVersion: apps/v1
kind: DaemonSet
metadata:
name: dind-test
labels:
run: dind-test
spec:
selector:
matchLabels:
run: dind-test
template:
metadata:
labels:
run: dind-test
spec:
containers:
# docker ≥19 serves a tls server by default on port 2376, ≤18 serves unencrypted on 2375
- image: docker:18-dind
name: dind
securityContext:
privileged: true
- image: docker:stable
name: docker
command: [/bin/sh]
args:
- -c
- |
set -x;
fails=0;
while true; do
sleep 10 && date;
if ! docker version; then fails=$((fails+1)); fi;
if [[ $fails -ge 3 ]]; then exit 1; fi;
done
env:
- name: DOCKER_HOST
value: tcp://localhost:2375
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment