mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-10-05 15:56:56 +00:00
kubernetes: Build image using Dockerfile and standard build system
This is a pretty straight port of the previous box stuff, without much attempt to clean things up. Image label is a placeholder, will update once a batch of changes are complete. Signed-off-by: Ian Campbell <ijc@docker.com>
This commit is contained in:
48
projects/kubernetes/kubernetes/Dockerfile
Normal file
48
projects/kubernetes/kubernetes/Dockerfile
Normal file
@@ -0,0 +1,48 @@
|
||||
#FROM linuxkit/alpine:9bcf61f605ef0ce36cc94d59b8eac307862de6e1 AS build
|
||||
# XXX needs ebtables ethtool iproute2 libc6-compat socat
|
||||
FROM alpine:3.6 AS build
|
||||
|
||||
ENV kubernetes_version v1.6.1
|
||||
ENV weave_version v1.9.4
|
||||
ENV cni_version 0799f5732f2a11b329d9e3d51b9c8f2e3759f2ff
|
||||
|
||||
ENV kube_release_artefacts "https://dl.k8s.io/${kubernetes_version}/bin/linux/amd64"
|
||||
|
||||
RUN apk add -U --no-cache \
|
||||
curl \
|
||||
&& true
|
||||
|
||||
RUN mkdir -p /out/etc/apk && cp -r /etc/apk/* /out/etc/apk/
|
||||
RUN apk add --no-cache --initdb -p /out \
|
||||
alpine-baselayout \
|
||||
busybox \
|
||||
ca-certificates \
|
||||
curl \
|
||||
ebtables \
|
||||
ethtool \
|
||||
iproute2 \
|
||||
iptables \
|
||||
libc6-compat \
|
||||
musl \
|
||||
socat \
|
||||
util-linux \
|
||||
&& true
|
||||
# Remove apk residuals. We have a read-only rootfs, so apk is of no use.
|
||||
RUN rm -rf /out/etc/apk /out/lib/apk /out/var/cache
|
||||
|
||||
ADD kubelet.sh /out/usr/bin/kubelet.sh
|
||||
ADD kubeadm-init.sh /out/usr/bin/kubeadm-init.sh
|
||||
|
||||
RUN curl -fSL -o /tmp/cni.tgz https://dl.k8s.io/network-plugins/cni-amd64-${cni_version}.tar.gz && \
|
||||
mkdir -p /out/opt/cni /out/etc/cni/net.d && \
|
||||
tar -xzf /tmp/cni.tgz -C /out/opt/cni
|
||||
RUN curl -fSL -o /out/etc/weave.yaml https://cloud.weave.works/k8s/v1.6/net?v=${weave_version}
|
||||
RUN curl -fSL -o /out/usr/bin/kubelet https://dl.k8s.io/${kubernetes_version}/bin/linux/amd64/kubelet && chmod 0755 /out/usr/bin/kubelet
|
||||
RUN curl -fSL -o /out/usr/bin/kubeadm https://dl.k8s.io/${kubernetes_version}/bin/linux/amd64/kubeadm && chmod 0755 /out/usr/bin/kubeadm
|
||||
RUN curl -fSL -o /out/usr/bin/kubectl https://dl.k8s.io/${kubernetes_version}/bin/linux/amd64/kubectl && chmod 0755 /out/usr/bin/kubectl
|
||||
|
||||
FROM scratch
|
||||
WORKDIR /
|
||||
ENTRYPOINT ["/usr/bin/kubelet.sh"]
|
||||
COPY --from=build /out /
|
||||
ENV KUBECONFIG "/etc/kubernetes/admin.conf"
|
6
projects/kubernetes/kubernetes/Makefile
Normal file
6
projects/kubernetes/kubernetes/Makefile
Normal file
@@ -0,0 +1,6 @@
|
||||
ORG?=linuxkitprojects
|
||||
IMAGE=kubernetes
|
||||
NETWORK=1
|
||||
NOTRUST=1
|
||||
|
||||
include ../../../pkg/package.mk
|
2
projects/kubernetes/kubernetes/kubeadm-init.sh
Executable file
2
projects/kubernetes/kubernetes/kubeadm-init.sh
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
kubeadm init --skip-preflight-checks --kubernetes-version v1.6.1 && kubectl create -n kube-system -f /etc/weave.yaml
|
2
projects/kubernetes/kubernetes/kubelet.sh
Executable file
2
projects/kubernetes/kubernetes/kubelet.sh
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
mount --bind /opt/cni /rootfs/opt/cni && mount --bind /etc/cni /rootfs/etc/cni && until kubelet --kubeconfig=/var/lib/kubeadm/kubelet.conf --require-kubeconfig=true --pod-manifest-path=/var/lib/kubeadm/manifests --allow-privileged=true --cluster-dns=10.96.0.10 --cluster-domain=cluster.local --cgroups-per-qos=false --enforce-node-allocatable= --network-plugin=cni --cni-conf-dir=/etc/cni/net.d --cni-bin-dir=/opt/cni/bin ; do [ ! -e /dev/sr0 ] && sleep 1 || (mount -o ro /dev/sr0 /mnt && kubeadm join --skip-preflight-checks $(cat /mnt/config)) ; done
|
Reference in New Issue
Block a user