Skip to content

Commit

Permalink
Merge pull request #40 from utilitywarehouse/calico-mount
Browse files Browse the repository at this point in the history
mount calico dirs in kubelet
  • Loading branch information
george-angel authored Jun 7, 2018
2 parents f133389 + 71e1e0e commit a7410c1
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 39 deletions.
49 changes: 24 additions & 25 deletions resources/master-kubelet.service
Original file line number Diff line number Diff line change
Expand Up @@ -5,43 +5,42 @@ After=systemd-resolved.service
Environment=KUBELET_IMAGE_URL=${kubelet_image_url}
Environment=KUBELET_IMAGE_TAG=${kubelet_image_tag}
Environment="RKT_RUN_ARGS=\
--uuid-file-save=/var/run/kubelet-pod.uuid \
--volume var-log,kind=host,source=/var/log \
--mount volume=var-log,target=/var/log \
--volume cni-bin,kind=host,source=/opt/cni/bin \
--mount volume=cni-bin,target=/opt/cni/bin \
--volume var-lib-cni,kind=host,source=/var/lib/cni \
--mount volume=var-lib-cni,target=/var/lib/cni \
--volume etc-cni-netd,kind=host,source=/etc/cni/net.d \
--mount volume=etc-cni-netd,target=/etc/cni/net.d \
--volume dns,kind=host,source=/etc/resolv.conf \
--mount volume=dns,target=/etc/resolv.conf"
--uuid-file-save=/var/run/kubelet-pod.uuid \
--volume var-log,kind=host,source=/var/log --mount volume=var-log,target=/var/log \
--volume cni-bin,kind=host,source=/opt/cni/bin --mount volume=cni-bin,target=/opt/cni/bin \
--volume var-lib-cni,kind=host,source=/var/lib/cni --mount volume=var-lib-cni,target=/var/lib/cni \
--volume etc-cni-netd,kind=host,source=/etc/cni/net.d --mount volume=etc-cni-netd,target=/etc/cni/net.d \
--volume dns,kind=host,source=/etc/resolv.conf --mount volume=dns,target=/etc/resolv.conf \
--volume var-run-calico,kind=host,source=/var/run/calico --mount volume=var-run-calico,target=/var/run/calico \
--volume var-lib-calico,kind=host,source=/var/lib/calico --mount volume=var-lib-calico,target=/var/lib/calico"
ExecStartPre=/usr/bin/mkdir -p /etc/kubernetes/manifests
ExecStartPre=/usr/bin/mkdir -p /var/log/containers
ExecStartPre=/usr/bin/mkdir -p /opt/cni/bin
ExecStartPre=/usr/bin/mkdir -p /var/lib/cni
ExecStartPre=/usr/bin/mkdir -p /etc/cni/net.d
ExecStartPre=/usr/bin/mkdir -p /var/run/calico
ExecStartPre=/usr/bin/mkdir -p /var/lib/calico
ExecStartPre=/sbin/sysctl -w net.ipv4.tcp_retries2=8
ExecStartPre=/opt/bin/cfssl-sk-get
ExecStartPre=/opt/bin/cfssl-new-cert
ExecStartPre=-/bin/sh -c "docker restart $(docker ps --no-trunc | grep '/hyperkube controller-manager' | awk '{ print $1; }')"
ExecStartPre=-/bin/sh -c "docker restart $(docker ps --no-trunc | grep '/hyperkube apiserver' | awk '{ print $1; }')"
ExecStartPre=-/usr/bin/rkt rm --uuid-file=/var/run/kubelet-pod.uuid
ExecStart=/usr/lib/coreos/kubelet-wrapper \
--kubeconfig=/var/lib/kubelet/kubeconfig \
--node-labels=role=master \
--register-node=true \
--register-with-taints=node-role.kubernetes.io/master=:NoSchedule \
--container-runtime=docker \
--network-plugin=cni \
--cni-bin-dir=/opt/cni/bin \
--cni-conf-dir=/etc/cni/net.d \
--allow-privileged=true \
--pod-manifest-path=/etc/kubernetes/manifests \
${cloud_provider == "" ? "" : "--cloud-provider=${cloud_provider}"} \
--cluster-dns=${cluster_dns} \
--cluster-domain=cluster.local \
--v=0
--kubeconfig=/var/lib/kubelet/kubeconfig \
--node-labels=role=master \
--register-node=true \
--register-with-taints=node-role.kubernetes.io/master=:NoSchedule \
--container-runtime=docker \
--network-plugin=cni \
--cni-bin-dir=/opt/cni/bin \
--cni-conf-dir=/etc/cni/net.d \
--allow-privileged=true \
--pod-manifest-path=/etc/kubernetes/manifests \
${cloud_provider == "" ? "" : "--cloud-provider=${cloud_provider}"} \
--cluster-dns=${cluster_dns} \
--cluster-domain=cluster.local \
--v=0
ExecStop=-/usr/bin/rkt stop --uuid-file=/var/run/kubelet-pod.uuid
Restart=always
RestartSec=10
Expand Down
25 changes: 11 additions & 14 deletions resources/worker-kubelet.service
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,22 @@ Environment=KUBELET_IMAGE_URL=${kubelet_image_url}
Environment=KUBELET_IMAGE_TAG=${kubelet_image_tag}
Environment="RKT_RUN_ARGS=\
--uuid-file-save=/var/run/kubelet-pod.uuid \
--volume var-log,kind=host,source=/var/log \
--mount volume=var-log,target=/var/log \
--volume cni-bin,kind=host,source=/opt/cni/bin \
--mount volume=cni-bin,target=/opt/cni/bin \
--volume var-lib-cni,kind=host,source=/var/lib/cni \
--mount volume=var-lib-cni,target=/var/lib/cni \
--volume etc-cni-netd,kind=host,source=/etc/cni/net.d \
--mount volume=etc-cni-netd,target=/etc/cni/net.d \
--volume dns,kind=host,source=/etc/resolv.conf \
--mount volume=dns,target=/etc/resolv.conf \
--volume modprobe,kind=host,source=/usr/sbin/modprobe \
--mount volume=modprobe,target=/usr/sbin/modprobe \
--volume lib-modules,kind=host,source=/lib/modules \
--mount volume=lib-modules,target=/lib/modules"
--volume var-log,kind=host,source=/var/log --mount volume=var-log,target=/var/log \
--volume cni-bin,kind=host,source=/opt/cni/bin --mount volume=cni-bin,target=/opt/cni/bin \
--volume var-lib-cni,kind=host,source=/var/lib/cni --mount volume=var-lib-cni,target=/var/lib/cni \
--volume etc-cni-netd,kind=host,source=/etc/cni/net.d --mount volume=etc-cni-netd,target=/etc/cni/net.d \
--volume dns,kind=host,source=/etc/resolv.conf --mount volume=dns,target=/etc/resolv.conf \
--volume var-run-calico,kind=host,source=/var/run/calico --mount volume=var-run-calico,target=/var/run/calico \
--volume var-lib-calico,kind=host,source=/var/lib/calico --mount volume=var-lib-calico,target=/var/lib/calico \
--volume modprobe,kind=host,source=/usr/sbin/modprobe --mount volume=modprobe,target=/usr/sbin/modprobe \
--volume lib-modules,kind=host,source=/lib/modules --mount volume=lib-modules,target=/lib/modules"
ExecStartPre=/usr/bin/mkdir -p /etc/kubernetes/manifests
ExecStartPre=/usr/bin/mkdir -p /var/log/containers
ExecStartPre=/usr/bin/mkdir -p /opt/cni/bin
ExecStartPre=/usr/bin/mkdir -p /var/lib/cni
ExecStartPre=/usr/bin/mkdir -p /etc/cni/net.d
ExecStartPre=/usr/bin/mkdir -p /var/run/calico
ExecStartPre=/usr/bin/mkdir -p /var/lib/calico
# This is a partial workaround to this upstream Kubernetes issue:
# https://github.com/kubernetes/kubernetes/issues/41916#issuecomment-312428731
ExecStartPre=/sbin/sysctl -w net.ipv4.tcp_retries2=8
Expand Down

0 comments on commit a7410c1

Please sign in to comment.