This repository has been archived by the owner on May 22, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 225
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
create a chroot aci for docker and kubelet
- Loading branch information
1 parent
c84f5d3
commit 76ac6c3
Showing
5 changed files
with
110 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.acbuild | ||
library-debian-jessie.aci | ||
node.aci |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#! /bin/bash | ||
|
||
set -o errexit | ||
set -o pipefail | ||
set -o nounset | ||
set -o xtrace | ||
|
||
rm -f node.aci | ||
|
||
docker2aci docker://debian:jessie | ||
|
||
acbuild begin ./library-debian-jessie.aci | ||
|
||
acbuild run -- apt-get update | ||
acbuild run -- apt-get install -y -q apparmor curl iptables | ||
acbuild run -- apt-get autoremove | ||
acbuild run -- apt-get clean | ||
|
||
acbuild run -- \ | ||
curl -sSL --fail \ | ||
"https://get.docker.com/builds/Linux/x86_64/docker-1.11.1.tgz" \ | ||
-o /opt/docker.tgz | ||
acbuild run -- tar xzfv /opt/docker.tgz --strip=1 -C "/usr/local/bin" | ||
acbuild run -- rm /opt/docker.tgz | ||
|
||
acbuild run -- \ | ||
curl -sSL --fail \ | ||
"https://storage.googleapis.com/kubernetes-release/release/v1.3.0-alpha.4/bin/linux/amd64/kubectl" \ | ||
-o "/usr/local/bin/kubectl" | ||
acbuild run -- chmod +x "/usr/local/bin/kubectl" | ||
|
||
acbuild run -- \ | ||
curl -sSL --fail \ | ||
"https://storage.googleapis.com/kubernetes-release/release/v1.3.0-alpha.4/bin/linux/amd64/kubelet" \ | ||
-o "/usr/local/bin/kubelet" | ||
acbuild run -- chmod +x "/usr/local/bin/kubelet" | ||
|
||
acbuild write node.aci | ||
acbuild end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
[Unit] | ||
Description=Docker Application Container Engine | ||
Documentation=https://docs.docker.com | ||
After=network.target | ||
|
||
[Service] | ||
Type=notify | ||
RootDirectory=/opt/kubelet/rootfs | ||
ExecStart=/usr/local/bin/docker daemon | ||
ExecReload=/bin/kill -s HUP $MAINPID | ||
LimitNOFILE=1048576 | ||
LimitNPROC=1048576 | ||
LimitCORE=infinity | ||
# Only systemd 226 and above support this version. | ||
TasksMax=infinity | ||
TimeoutStartSec=0 | ||
# set delegate yes so that systemd does not reset the cgroups of docker containers | ||
Delegate=yes | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
[Unit] | ||
Description=Kubernetes Kubelet Server | ||
Documentation=https://github.com/kubernetes/kubernetes | ||
After=network.target docker.socket | ||
|
||
[Service] | ||
RootDirectory=/opt/kubelet/rootfs | ||
ExecStart=/usr/local/bin/kubelet \ | ||
--address=0.0.0.0 \ | ||
--allow-privileged=true \ | ||
--enable-server \ | ||
--config=/etc/kubernetes/manifests \ | ||
--cluster-dns=10.0.0.10 \ | ||
--cluster-domain=cluster.local \ | ||
--v=2 | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#! /bin/bash | ||
|
||
set -o nounset | ||
set -o errexit | ||
set -o pipefail | ||
|
||
ROOTFS=/opt/kubelet/rootfs | ||
|
||
mount_in() { | ||
local path="${1}" | ||
local shared="${2:-false}" | ||
mkdir -p "${path}" | ||
mkdir -p "${ROOTFS}${path}" | ||
mount --rbind "${path}" "${ROOTFS}${path}" | ||
if [[ "${shared}" == "true" ]]; then | ||
mount --bind "${ROOTFS}${path}" "${ROOTFS}${path}" | ||
mount --make-shared "${ROOTFS}${path}" | ||
fi | ||
} | ||
|
||
tar xzvf node.aci -C /opt/kubelet | ||
|
||
mount_in /proc | ||
mount_in /sys | ||
mount_in /run | ||
mount_in /var/run | ||
mount_in /etc/kubernetes | ||
mount_in /var/lib/docker | ||
mount_in /var/lib/kubelet true |