From 4daf997a73bc07655b27d4008b64678df72d5766 Mon Sep 17 00:00:00 2001 From: Dalton Hubble Date: Sat, 8 Oct 2016 16:20:08 -0700 Subject: [PATCH] examples/k8s: Use CNI for Kubernetes clusters * Set the Docker bridge IP and IP masq to empty string * https://github.com/coreos/coreos-kubernetes/pull/551 --- examples/ignition/k8s-controller.yaml | 21 +++++++++++++++++++++ examples/ignition/k8s-worker.yaml | 21 +++++++++++++++++++++ examples/ignition/rktnetes-controller.yaml | 1 + 3 files changed, 43 insertions(+) diff --git a/examples/ignition/k8s-controller.yaml b/examples/ignition/k8s-controller.yaml index 22f669fc..11284888 100644 --- a/examples/ignition/k8s-controller.yaml +++ b/examples/ignition/k8s-controller.yaml @@ -28,6 +28,8 @@ systemd: [Unit] Requires=flanneld.service After=flanneld.service + [Service] + EnvironmentFile=/etc/kubernetes/cni/docker_opts_cni.env - name: k8s-certs@.service contents: | [Unit] @@ -67,6 +69,8 @@ systemd: ExecStart=/usr/lib/coreos/kubelet-wrapper \ --api-servers=http://127.0.0.1:8080 \ --register-schedulable=true \ + --network-plugin-dir=/etc/kubernetes/cni/net.d \ + --network-plugin=cni \ --allow-privileged=true \ --config=/etc/kubernetes/manifests \ --hostname-override={{.domain_name}} \ @@ -105,6 +109,23 @@ storage: - "-LROOT" {{end}} files: + - path: /etc/kubernetes/cni/net.d/10-flannel.conf + filesystem: root + contents: + inline: | + { + "name": "podnet", + "type": "flannel", + "delegate": { + "isDefaultGateway": true + } + } + - path: /etc/kubernetes/cni/docker_opts_cni.env + filesystem: root + contents: + inline: | + DOCKER_OPT_BIP="" + DOCKER_OPT_IPMASQ="" - path: /etc/kubernetes/manifests/kube-proxy.yaml filesystem: root contents: diff --git a/examples/ignition/k8s-worker.yaml b/examples/ignition/k8s-worker.yaml index 0eb7073b..852c7991 100644 --- a/examples/ignition/k8s-worker.yaml +++ b/examples/ignition/k8s-worker.yaml @@ -23,6 +23,8 @@ systemd: [Unit] Requires=flanneld.service After=flanneld.service + [Service] + EnvironmentFile=/etc/kubernetes/cni/docker_opts_cni.env - name: k8s-certs@.service contents: | [Unit] @@ -60,6 +62,8 @@ systemd: ExecStart=/usr/lib/coreos/kubelet-wrapper \ --api-servers={{.k8s_controller_endpoint}} \ --register-node=true \ + --network-plugin-dir=/etc/kubernetes/cni/net.d \ + --network-plugin=cni \ --allow-privileged=true \ --config=/etc/kubernetes/manifests \ --hostname-override={{.domain_name}} \ @@ -91,6 +95,23 @@ storage: - "-LROOT" {{end}} files: + - path: /etc/kubernetes/cni/net.d/10-flannel.conf + filesystem: root + contents: + inline: | + { + "name": "podnet", + "type": "flannel", + "delegate": { + "isDefaultGateway": true + } + } + - path: /etc/kubernetes/cni/docker_opts_cni.env + filesystem: root + contents: + inline: | + DOCKER_OPT_BIP="" + DOCKER_OPT_IPMASQ="" - path: /etc/kubernetes/worker-kubeconfig.yaml filesystem: root contents: diff --git a/examples/ignition/rktnetes-controller.yaml b/examples/ignition/rktnetes-controller.yaml index dea903ff..3fca230b 100644 --- a/examples/ignition/rktnetes-controller.yaml +++ b/examples/ignition/rktnetes-controller.yaml @@ -70,6 +70,7 @@ systemd: --mount volume=var-log,target=/var/log" Environment=KUBELET_VERSION=v1.3.6_coreos.0 ExecStartPre=/usr/bin/mkdir -p /etc/kubernetes/manifests + ExecStartPre=/usr/bin/mkdir -p /var/log/containers ExecStartPre=/usr/bin/systemctl is-active flanneld.service ExecStart=/usr/lib/coreos/kubelet-wrapper \ --api-servers=http://127.0.0.1:8080 \