Browse Source

install cni plugins required by kubenet

Fabian Peter Hammerle 4 years ago
parent
commit
e90a730e87
1 changed files with 14 additions and 1 deletions
  1. 14 1
      Dockerfile

+ 14 - 1
Dockerfile

@@ -11,9 +11,22 @@ RUN apt-get update && apt-get install --yes --no-install-recommends \
 # k8s.gcr.io/kube-proxy:v1.17.0 uses legacy iptables
 RUN update-alternatives --set iptables /usr/sbin/iptables-legacy
 
+# https://github.com/kubernetes/kubernetes/blob/v1.17.0/pkg/kubelet/dockershim/network/kubenet/kubenet_linux.go#L88
+ARG CNI_PLUGINS_VERSION=v0.8.5
+ARG CNI_BIN_DIR=/opt/cni/bin
+ARG CNI_PLUGINS="\
+    ./bridge \
+    ./host-local \
+    ./loopback \
+    "
+RUN mkdir --parents $CNI_BIN_DIR \
+    && curl --location https://github.com/containernetworking/plugins/releases/download/$CNI_PLUGINS_VERSION/cni-plugins-linux-amd64-$CNI_PLUGINS_VERSION.tgz \
+        | tar --ungzip --extract --verbose --directory=$CNI_BIN_DIR -- $CNI_PLUGINS \
+    && ls -l --human-readable --all $CNI_BIN_DIR
+
 ARG KUBERNETES_VERSION=v1.17.0
 RUN curl --location https://dl.k8s.io/$KUBERNETES_VERSION/kubernetes-node-linux-amd64.tar.gz \
-    | tar -xvz --directory=/usr/local/bin --strip-components=3 kubernetes/node/bin/kubelet
+    | tar --ungzip --extract --verbose --directory=/usr/local/bin --strip-components=3 kubernetes/node/bin/kubelet
 
 #RUN apt-get install --yes --no-install-recommends strace
 #ENTRYPOINT ["strace", "-f"]