forked from play-with-docker/play-with-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial k8s support in libplayground (play-with-docker#216)
* Initial k8s support in libplayground * Make tasks never give up + custom event for k8s cluster status
- Loading branch information
1 parent
dcb2bc7
commit 3481442
Showing
24 changed files
with
1,004 additions
and
56 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
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
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,32 @@ | ||
FROM centos:7 | ||
|
||
COPY ./systemctl /usr/bin/systemctl | ||
COPY ./kubernetes.repo /etc/yum.repos.d/ | ||
|
||
|
||
|
||
RUN yum install -y kubelet kubeadm \ | ||
&& mv -f /etc/systemd/system/kubelet.service.d/10-kubeadm.conf /etc/systemd/system/kubelet.service \ | ||
&& yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo \ | ||
&& yum install -y docker-ce \ | ||
&& sed -i -e '4d;5d;8d' /lib/systemd/system/docker.service \ | ||
&& yum clean all | ||
|
||
RUN curl -Lf -o jq https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux64 \ | ||
&& chmod +x ./jq && mv jq /usr/bin | ||
|
||
COPY ./kube* /etc/systemd/system/ | ||
COPY ./wrapkubeadm.sh /usr/local/bin/kubeadm | ||
COPY ./tokens.csv /etc/pki/tokens.csv | ||
COPY ./daemon.json /etc/docker/ | ||
|
||
COPY motd /etc/motd | ||
|
||
RUN echo $'cat /etc/motd \n\ | ||
export PS1="[\h \W]$ "' >> /root/.bash_profile | ||
|
||
RUN mkdir -p /root/.kube && ln -s /etc/kubernetes/admin.conf /root/.kube/config \ | ||
&& rm -f /etc/machine-id | ||
|
||
CMD systemctl start docker && systemctl start kubelet \ | ||
&& while true; do bash -l; done |
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,8 @@ | ||
FROM franela/kind_builder | ||
|
||
COPY motd /etc/motd | ||
RUN echo $'cat /etc/motd \n\ | ||
export PS1="[\h \W]$ "' >> /root/.bash_profile | ||
|
||
CMD systemctl start docker && systemctl start kubelet \ | ||
&& while true; do bash -l; done |
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,7 @@ | ||
{ | ||
"experimental": true, | ||
"debug": true, | ||
"log-level": "info", | ||
"insecure-registries": ["127.0.0.1"], | ||
"hosts": ["unix:///var/run/docker.sock", "tcp://0.0.0.0:2375"] | ||
} |
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,8 @@ | ||
KUBELET_KUBECONFIG_ARGS=" --bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf" | ||
KUBELET_SYSTEM_PODS_ARGS="--pod-manifest-path=/etc/kubernetes/manifests --allow-privileged=true" | ||
KUBELET_NETWORK_ARGS="--network-plugin=cni --cni-conf-dir=/etc/cni/net.d --cni-bin-dir=/opt/cni/bin" | ||
KUBELET_DNS_ARGS="--cluster-dns=10.96.0.10 --cluster-domain=cluster.local" | ||
KUBELET_AUTHZ_ARGS="--authorization-mode=Webhook --client-ca-file=/etc/kubernetes/pki/ca.crt" | ||
KUBELET_CADVISOR_ARGS="--cadvisor-port=0" | ||
KUBELET_CGROUP_ARGS="--cgroup-driver=cgroupfs" | ||
KUBELET_EXTRA_ARGS="--fail-swap-on=false" |
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,4 @@ | ||
[Service] | ||
Restart=always | ||
EnvironmentFile=/etc/systemd/system/kubelet.env | ||
ExecStart=/usr/bin/kubelet $KUBELET_KUBECONFIG_ARGS $KUBELET_SYSTEM_PODS_ARGS $KUBELET_NETWORK_ARGS $KUBELET_DNS_ARGS $KUBELET_AUTHZ_ARGS $KUBELET_CADVISOR_ARGS $KUBELET_CGROUP_ARGS $KUBELET_EXTRA_ARGS |
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,8 @@ | ||
[kubernetes] | ||
name=Kubernetes | ||
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64 | ||
enabled=1 | ||
gpgcheck=1 | ||
repo_gpgcheck=1 | ||
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg | ||
https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg |
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,30 @@ | ||
|
||
WARNING!!!! | ||
|
||
This is a sandbox environment. Using personal credentials | ||
is HIGHLY! discouraged. Any consequences of doing so, are | ||
completely the user's responsibilites. | ||
|
||
You can bootstrap a cluster as follows: | ||
|
||
1. Initializes cluster master node: | ||
|
||
kubeadm init --apiserver-advertise-address $(hostname -i) | ||
|
||
|
||
2. Initialize cluster networking: | ||
|
||
kubectl apply -n kube-system -f \ | ||
"https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d '\n')" | ||
|
||
|
||
3. (Optional) Initialize kube-dashboard: | ||
|
||
curl -L -s https://git.io/kube-dashboard | sed 's/targetPort: 9090/targetPort: 9090\n type: LoadBalancer/' | \ | ||
kubectl apply -f - | ||
|
||
|
||
The PWK team. | ||
|
||
|
||
|
Oops, something went wrong.