├── Dockerfile ├── LICENSE ├── README.md └── entrypoint.sh /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine 2 | RUN apk --update add bash curl ca-certificates 3 | COPY entrypoint.sh / 4 | ENTRYPOINT ["/entrypoint.sh"] 5 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Lucas Käldström 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## kubeadm installer for CoreOS, Ubuntu, Debian, CentOS and Fedora 2 | 3 | 4 | > **MAINTAINER HAS SWITCHED !** 5 | > 6 | > Use https://github.com/xakraz/kubeadm-installer for the latest update and PRs 7 | 8 | 9 | 10 | ### How to run install kubeadm 11 | 12 | Given docker already is installed (otherwise, run `curl get.docker.com | bash`), you can install kubeadm easily! 13 | 14 | ```bash 15 | $ docker run -it \ 16 | -v /etc/cni:/rootfs/etc/cni \ 17 | -v /etc/systemd:/rootfs/etc/systemd \ 18 | -v /opt:/rootfs/opt \ 19 | -v /usr/bin:/rootfs/usr/bin \ 20 | luxas/kubeadm-installer ${your_os_here} 21 | ``` 22 | 23 | `${your_os_here}` can be `coreos`, `ubuntu`, `debian`, `fedora` or `centos` 24 | 25 | ### How to uninstall/revert 26 | 27 | ```bash 28 | $ docker run -it \ 29 | -v /etc/cni:/rootfs/etc/cni \ 30 | -v /etc/systemd:/rootfs/etc/systemd \ 31 | -v /opt:/rootfs/opt \ 32 | -v /usr/bin:/rootfs/usr/bin \ 33 | luxas/kubeadm-installer ${your_os_here} uninstall 34 | ``` 35 | 36 | ### What's inside? 37 | 38 | - kubeadm `v1.5.0-alpha.2.421+a6bea3d79b8bba`, see releases here: http://kubernetes.io/docs/admin/kubeadm/ 39 | - kubernetes `v1.4.4` 40 | - cni `07a8a28637e97b22eb8dfe710eeae1344f69d16e` 41 | 42 | ### License 43 | 44 | MIT 45 | -------------------------------------------------------------------------------- /entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ROOTFS=${ROOTFS:-/rootfs} 4 | K8S_VERSION=${K8S_VERSION:-v1.4.4} 5 | KUBEADM_RELEASE=${KUBEADM_RELEASE:-v1.5.0-alpha.2.421+a6bea3d79b8bba} 6 | CNI_RELEASE=${CNI_RELEASE:-07a8a28637e97b22eb8dfe710eeae1344f69d16e} 7 | ARCH=${ARCH:-amd64} 8 | CNI_BIN_DIR=${CNI_BIN_DIR:-/opt/cni} 9 | 10 | if [[ $1 == "coreos" ]]; then 11 | BIN_DIR=${BIN_DIR:-/opt/bin} 12 | KUBELET_EXEC=${KUBELET_EXEC:-/usr/lib/coreos/kubelet-wrapper} 13 | EXTRA_ENVIRONMENT=${EXTRA_ENVIRONMENT:-"RKT_OPTS=--volume opt-cni,kind=host,source=/opt/cni --mount volume=opt-cni,target=/opt/cni --volume etc-cni,kind=host,source=/etc/cni --mount volume=etc-cni,target=/etc/cni"} 14 | elif [[ $1 == "ubuntu" || $1 == "debian" || $1 == "fedora" || $1 == "centos" ]]; then 15 | BIN_DIR=${BIN_DIR:-/usr/bin} 16 | KUBELET_EXEC=${KUBELET_EXEC:-${BIN_DIR}/kubelet} 17 | EXTRA_ENVIRONMENT=${EXTRA_ENVIRONMENT:-"NOOP=true"} 18 | INSTALL_KUBELET=1 19 | else 20 | cat <<-EOF 21 | Hi, you should run this container like this: 22 | docker run -it -v /etc/cni:/etc/cni -v /etc/systemd:/etc/systemd -v /opt:/opt -v /usr/bin:/usr/bin luxas/kubeadm-installer your_os_here 23 | 24 | your_os_here can be coreos, ubuntu, debian, fedora or centos 25 | 26 | You can also revert this action with running: 27 | docker run -it -v /etc/:/rootfs/etc -v /usr:/rootfs/usr -v /opt:/rootfs/opt luxas/kubeadm-installer uninstall 28 | EOF 29 | exit 1 30 | fi 31 | 32 | if [[ $2 == "uninstall" ]]; then 33 | rm -rf ${ROOTFS}/etc/cni ${ROOTFS}/${BIN_DIR}/kubectl ${ROOTFS}/${BIN_DIR}/kubelet ${ROOTFS}/${BIN_DIR}/kubeadm ${ROOTFS}/${CNI_BIN_DIR} ${ROOTFS}/etc/systemd/system/kubelet.service 34 | echo "Removed /etc/cni, ${BIN_DIR}/kubectl, ${BIN_DIR}/kubelet, ${BIN_DIR}/kubeadm, /opt/cni and /etc/systemd/system/kubelet.service" 35 | exit 1 36 | fi 37 | 38 | mkdir -p ${ROOTFS}/etc/cni ${ROOTFS}/${BIN_DIR} 39 | 40 | if [[ ! -f ${ROOTFS}/${BIN_DIR}/kubectl ]]; then 41 | curl -sSL https://storage.googleapis.com/kubernetes-release/release/${K8S_VERSION}/bin/linux/${ARCH}/kubectl > ${ROOTFS}/${BIN_DIR}/kubectl 42 | chmod +x ${ROOTFS}/${BIN_DIR}/kubectl 43 | echo "Installed kubectl in ${BIN_DIR}/kubectl" 44 | else 45 | echo "Ignoring ${BIN_DIR}/kubectl, since it seems to exist already" 46 | fi 47 | 48 | if [[ ! -f ${ROOTFS}/${BIN_DIR}/kubelet && ${INSTALL_KUBELET} == 1 ]]; then 49 | curl -sSL https://storage.googleapis.com/kubernetes-release/release/${K8S_VERSION}/bin/linux/${ARCH}/kubelet > ${ROOTFS}/${BIN_DIR}/kubelet 50 | chmod +x ${ROOTFS}/${BIN_DIR}/kubelet 51 | echo "Installed kubelet in ${BIN_DIR}/kubelet" 52 | else 53 | echo "Ignoring ${BIN_DIR}/kubelet, since it seems to exist already" 54 | fi 55 | 56 | if [[ ! -f ${ROOTFS}/${BIN_DIR}/kubeadm ]]; then 57 | curl -sSL https://storage.googleapis.com/kubernetes-release-dev/ci-cross/${KUBEADM_RELEASE}/bin/linux/${ARCH}/kubeadm > ${ROOTFS}/${BIN_DIR}/kubeadm 58 | chmod +x ${ROOTFS}/${BIN_DIR}/kubeadm 59 | echo "Installed kubeadm in ${BIN_DIR}/kubeadm" 60 | else 61 | echo "Ignoring ${BIN_DIR}/kubeadm, since it seems to exist already" 62 | fi 63 | 64 | if [[ ! -d ${ROOTFS}/${CNI_BIN_DIR} ]]; then 65 | mkdir -p ${ROOTFS}/${CNI_BIN_DIR} 66 | curl -sSL https://storage.googleapis.com/kubernetes-release/network-plugins/cni-${ARCH}-${CNI_RELEASE}.tar.gz | tar -xz -C ${ROOTFS}/${CNI_BIN_DIR} 67 | echo "Installed CNI binaries in /opt/cni" 68 | else 69 | echo "Ignoring /opt/cni, since it seems to exist already" 70 | fi 71 | 72 | if [[ ! -f ${ROOTFS}/etc/systemd/system/kubelet.service ]]; then 73 | cat > ${ROOTFS}/etc/systemd/system/kubelet.service <<-EOF 74 | [Unit] 75 | Description=kubelet: The Kubernetes Node Agent 76 | Documentation=http://kubernetes.io/docs/ 77 | 78 | [Service] 79 | Environment="KUBELET_VERSION=${K8S_VERSION}_coreos.0" 80 | Environment="${EXTRA_ENVIRONMENT}" 81 | ExecStart=${KUBELET_EXEC} --kubeconfig=/etc/kubernetes/kubelet.conf --require-kubeconfig=true --pod-manifest-path=/etc/kubernetes/manifests --allow-privileged=true --network-plugin=cni --cni-conf-dir=/etc/cni/net.d --cni-bin-dir=/opt/cni/bin --cluster-dns=10.96.0.10 --cluster-domain=cluster.local 82 | Restart=always 83 | StartLimitInterval=0 84 | RestartSec=10 85 | 86 | [Install] 87 | WantedBy=multi-user.target 88 | EOF 89 | echo "Installed the kubelet.service in /etc/systemd/system/kubelet.service" 90 | else 91 | echo "Ignoring /etc/systemd/system/kubelet.service, since it seems to exist already" 92 | fi 93 | 94 | cat <