Dockerfile 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. FROM debian:buster-slim
  2. # > cni.go:364] [...] exec: "iptables": executable file not found in $PATH
  3. # > docker_sandbox.go:394] failed to read pod IP from plugin/docker: networkPlugin cni [...]: unexpected command output nsenter: failed to execute ip: No such file or directory
  4. # > portforward.go:400] [...] unable to do port forwarding: socat not found
  5. # https://github.com/kubernetes/kubernetes/blob/v1.17.0/pkg/kubelet/dockershim/docker_streaming_others.go#L42
  6. RUN apt-get update && apt-get install --yes --no-install-recommends \
  7. ca-certificates \
  8. curl \
  9. iproute2 \
  10. iptables \
  11. socat `# kubectl port-forward` \
  12. util-linux `# nsenter`
  13. # k8s.gcr.io/kube-proxy:v1.17.0 uses legacy iptables
  14. RUN update-alternatives --set iptables /usr/sbin/iptables-legacy
  15. # https://github.com/kubernetes/kubernetes/blob/v1.17.0/pkg/kubelet/dockershim/network/kubenet/kubenet_linux.go#L88
  16. ARG CNI_PLUGINS_VERSION=v0.8.5
  17. ARG CNI_BIN_DIR=/opt/cni/bin
  18. ARG CNI_PLUGINS="\
  19. ./bridge \
  20. ./host-local \
  21. ./loopback \
  22. "
  23. RUN mkdir --parents $CNI_BIN_DIR \
  24. && curl --location https://github.com/containernetworking/plugins/releases/download/$CNI_PLUGINS_VERSION/cni-plugins-linux-amd64-$CNI_PLUGINS_VERSION.tgz \
  25. | tar --ungzip --extract --verbose --directory=$CNI_BIN_DIR -- $CNI_PLUGINS \
  26. && ls -l --human-readable --all $CNI_BIN_DIR
  27. ARG KUBERNETES_VERSION=v1.17.0
  28. RUN curl --location https://dl.k8s.io/$KUBERNETES_VERSION/kubernetes-node-linux-amd64.tar.gz \
  29. | tar --ungzip --extract --verbose --directory=/usr/local/bin --strip-components=3 kubernetes/node/bin/kubelet
  30. #RUN apt-get install --yes --no-install-recommends strace
  31. #ENTRYPOINT ["strace", "-f"]
  32. # --healthz-port
  33. HEALTHCHECK CMD [ "$(curl --silent --show-error http://localhost:10248/healthz)" = "ok" ] || exit 1