Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 47 additions & 6 deletions pkg/kubelet/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
FROM linuxkit/alpine:07f7d136e427dc68154cd5edbb2b9576f9ac5213 AS build

# When changing kubernetes_version remember to also update:
# - scripts/mk-image-cache-lst and run `make refresh-image-caches` from top-level
ENV kubernetes_version v1.9.0
ENV cni_version v0.6.0
ENV critools_version v1.0.0-alpha.0

RUN apk add -U --no-cache \
bash \
Expand All @@ -19,6 +22,8 @@ RUN apk add -U --no-cache \

ENV GOPATH=/go PATH=$PATH:/go/bin

### Kubernetes (incl Kubelet)

ENV KUBERNETES_URL https://github.com/kubernetes/kubernetes.git
#ENV KUBERNETES_BRANCH pull/NNN/head
ENV KUBERNETES_COMMIT ${kubernetes_version}
Expand All @@ -34,6 +39,40 @@ RUN set -e; \

RUN make WHAT="cmd/kubelet cmd/kubectl cmd/kubeadm"

### CNI plugins

ENV CNI_URL https://github.com/containernetworking/plugins
#ENV CNI_BRANCH pull/NNN/head
ENV CNI_COMMIT ${cni_version}
RUN mkdir -p $GOPATH/github.com/containernetworking/ && \
cd $GOPATH/github.com/containernetworking/ && \
git clone $CNI_URL plugins
WORKDIR $GOPATH/github.com/containernetworking/plugins
RUN set -e; \
if [ -n "$CNI_BRANCH" ] ; then \
git fetch origin "CNI_BRANCH"; \
fi; \
git checkout $CNI_COMMIT
RUN ./build.sh

### critools

ENV CRITOOLS_URL https://github.com/kubernetes-incubator/cri-tools
#ENV CRITOOLS_BRANCH pull/NNN/head
ENV CRITOOLS_COMMIT ${critools_version}
RUN mkdir -p $GOPATH/github.com/kubernetes-incubator/ && \
cd $GOPATH/github.com/kubernetes-incubator/ && \
git clone $CRITOOLS_URL cri-tools
WORKDIR $GOPATH/github.com/kubernetes-incubator/cri-tools
RUN set -e; \
if [ -n "$CRITOOLS_BRANCH" ] ; then \
git fetch origin "CRITOOLS_BRANCH"; \
fi; \
git checkout $CRITOOLS_COMMIT
RUN make binaries

## Construct final image

RUN mkdir -p /out/etc/apk && cp -r /etc/apk/* /out/etc/apk/
#coreutils needed for du -B for disk image checks made by kubelet
# example: $ du -s -B 1 /var/lib/kubelet/pods/...
Expand All @@ -48,24 +87,26 @@ RUN apk add --no-cache --initdb -p /out \
ethtool \
iproute2 \
iptables \
libc6-compat \
musl \
openssl \
socat \
util-linux \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm pretty sure we can get rid of libc6-compat now, wdyt?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't remember what it was needed for (maybe it was even cargo-culted from somewhere else and never useful here). If someone wants to remove it and test the result that would be great.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ilj it was needed to run Kubernetes release binaries, it's not needed since we build here, although I don't know about the CNI binaries, but that's not a question as of this PR. I've put it there in the first place.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, yes, it's probably useless then.

I'll try and pin a commit on here before I head off for vacation then!

&& true

RUN cp _output/bin/kubelet /out/usr/bin/kubelet
RUN cp _output/bin/kubeadm /out/usr/bin/kubeadm
RUN cp _output/bin/kubectl /out/usr/bin/kubectl
RUN cp $GOPATH/src/github.com/kubernetes/kubernetes/_output/bin/kubelet /out/usr/bin/kubelet
RUN cp $GOPATH/src/github.com/kubernetes/kubernetes/_output/bin/kubeadm /out/usr/bin/kubeadm
RUN cp $GOPATH/src/github.com/kubernetes/kubernetes/_output/bin/kubectl /out/usr/bin/kubectl

RUN tar -czf /out/root/cni.tgz -C $GOPATH/github.com/containernetworking/plugins/bin .

RUN cp $GOPATH/bin/crictl /out/usr/bin/crictl
RUN cp $GOPATH/bin/critest /out/usr/bin/critest

# 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

RUN rmdir /out/var/run && ln -nfs /run /out/var/run

RUN curl -fSL -o /out/root/cni.tgz https://github.com/containernetworking/plugins/releases/download/${cni_version}/cni-plugins-amd64-${cni_version}.tgz

ADD kubelet.sh /out/usr/bin/kubelet.sh
ADD kubeadm-init.sh /kubeadm-init.sh
RUN sed -e "s/@KUBERNETES_VERSION@/${kubernetes_version}/g" </kubeadm-init.sh >/out/usr/bin/kubeadm-init.sh && chmod +x /out/usr/bin/kubeadm-init.sh
Expand Down
12 changes: 7 additions & 5 deletions scripts/mk-image-cache-lst
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
#!/bin/sh
repo=gcr.io/google_containers
kube_version=v1.9.0
# When changing kubernetes_version remember to also update:
# - pkg/kubelet/Dockerfile
kubernetes_version=v1.9.0
kube_dns_version=1.14.7
pause_version=3.0
etcd_version=3.1.10

common="
kube-proxy-amd64:$kube_version
kube-proxy-amd64:$kubernetes_version
k8s-dns-sidecar-amd64:$kube_dns_version
k8s-dns-kube-dns-amd64:$kube_dns_version
k8s-dns-dnsmasq-nanny-amd64:$kube_dns_version
pause-amd64:$pause_version"

control="
kube-apiserver-amd64:$kube_version
kube-controller-manager-amd64:$kube_version
kube-scheduler-amd64:$kube_version
kube-apiserver-amd64:$kubernetes_version
kube-controller-manager-amd64:$kubernetes_version
kube-scheduler-amd64:$kubernetes_version
etcd-amd64:$etcd_version"

oi() {
Expand Down
2 changes: 1 addition & 1 deletion yml/kube.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ services:
- name: sshd
image: linuxkit/sshd:ac5e8364e2e9aa8717a3295c51eb60b8c57373d5
- name: kubelet
image: linuxkit/kubelet:d581c755f04a8a4060e9947cabe737d6b70fdd1b
image: linuxkit/kubelet:03205e3daddfeedeb64d4e023b42c225c8e00945
files:
- path: etc/linuxkit.yml
metadata: yaml
Expand Down