DataDog/pupernetes

Name: pupernetes

Owner: Datadog, Inc.

Description: Quickly setup & run a production-like Kubernetes environment locally

Created: 2018-04-12 14:51:34.0

Updated: 2018-05-23 12:59:15.0

Pushed: 2018-05-24 12:30:55.0

Homepage:

Size: 4529

Language: Go

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

pupernetes - p8s

Run a Kubernetes setup in 45 seconds.

img

Provides:

The default setup is secured with:

Table of Contents
Requirements
Runtime

Executables in PATH:

Any implicit requirements for the kubelet like the container runtime and more

A systemd environment.

Development

Setup a linux environment for running pupernetes. This is only a suggested environment for running pupernetes. You could also create a VM using Vagrant (not yet documented here).

Install VMWare Fusion

pupernetes must be run on linux. To run a linux VM install VMWare Fusion or your preferred virtualization software. You can use the VMWare Fusion Pro 30-day trial.

Create Ubuntu VM

Download the latest version of Ubuntu Desktop and create the Ubuntu VM with VMWare Fusion or whichever virtualization software you prefer.

Install Docker

Follow the instructions here to install docker.

Note:

If you are seeing the following error after running sudo apt-get install docker-ce to install docker-ce.

nvalid operation docker-ce

Try running the following command to setup the stable repository that instead specifies an older Ubuntu distribution like xenial instead of using lsb_release -cs (using bionic doesn't seem to always works).

do add-apt-repository \
eb [arch=amd64] https://download.docker.com/linux/ubuntu \
nial \
ble"

Now try running $ sudo apt-get install docker-ce again.

To manage docker as a non-root user (so you don't have to keep using sudo) follow the instructions here. You must log out and log back in (or just restart your VM) so that your group membership is re-evaluated

Build it
Run it
 ./pupernetes run sandbox/
ext
2 19:24:01.349686   38841 clean.go:30] Removed /home/jb/go/src/github.com/DataDog/pupernetes/sandbox/etcd-data
2 19:24:01.350733   38841 clean.go:136] Cleanup successfully finished
2 19:24:03.788224   38841 systemd.go:31] Already created systemd unit: /run/systemd/system/p8s-kubelet.service
2 19:24:03.788277   38841 systemd.go:31] Already created systemd unit: /run/systemd/system/p8s-etcd.service
2 19:24:05.277634   38841 setup.go:249] Setup ready /home/jb/go/src/github.com/DataDog/pupernetes/sandbox
2 19:24:05.278049   38841 run.go:95] Timeout for this current run is 6h0m0s
2 19:24:05.278124   38841 systemd.go:40] Starting systemd unit: p8s-etcd.service ...
2 19:24:06.024161   38841 systemd.go:40] Starting systemd unit: p8s-kubelet.service ...
2 19:24:07.034545   38841 run.go:192] Kubenertes apiserver not ready yet: Get http://127.0.0.1:8080/healthz: dial tcp 127.0.0.1:8080: connect: connection refused
2 19:24:21.031852   38841 run.go:192] Kubenertes apiserver not ready yet: bad status code for http://127.0.0.1:8080/healthz: 500
2 19:24:24.031872   38841 kubectl.go:14] Calling kubectl apply -f /home/jb/go/src/github.com/DataDog/pupernetes/sandbox/manifest-api ...
2 19:24:25.541348   38841 kubectl.go:21] Successfully applied manifests:
iceaccount "coredns" created
terrole.rbac.authorization.k8s.io "system:coredns" created
terrolebinding.rbac.authorization.k8s.io "system:coredns" created
igmap "coredns" created
oyment.extensions "coredns" created
ice "coredns" created
terrolebinding.rbac.authorization.k8s.io "p8s-admin" created
iceaccount "kube-controller-manager" created
"kube-controller-manager" created
onset.extensions "kube-proxy" created
onset.extensions "kube-scheduler" created
2 19:24:25.541409   38841 run.go:156] Kubernetes apiserver hooks done
2 19:24:26.091092   38841 run.go:176] Kubelet is running 1 pods
2 19:24:36.035496   38841 run.go:176] Kubelet is running 4 pods
2 19:24:46.044459   38841 run.go:176] Kubelet is running 5 pods
Use it

Note:

kubectl is automatically installed by pupernetes.

You may need to run the following command to add kubectl to the $PATH:

 ./pupernetes run sandbox/ --kubectl-link /usr/local/bin/kubectl
ctl get svc,ds,deploy,job,po --all-namespaces
ext
SPACE     NAME         TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)         AGE
ult       kubernetes   ClusterIP   192.168.254.1   <none>        443/TCP         3m
-system   coredns      ClusterIP   192.168.254.2   <none>        53/UDP,53/TCP   3m

SPACE     NAME             DESIRED   CURRENT   READY     UP-TO-DATE   AVAILABLE   NODE SELECTOR   AGE
-system   kube-proxy       1         1         1         1            1           <none>          3m
-system   kube-scheduler   1         1         1         1            1           <none>          3m

SPACE     NAME      DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE
-system   coredns   1         1         1            1           3m

SPACE     NAME                       READY     STATUS    RESTARTS   AGE
-system   coredns-747dbcf5df-p2lhq   1/1       Running   0          3m
-system   kube-apiserver-v1704       1/1       Running   0          2m
-system   kube-controller-manager    1/1       Running   0          3m
-system   kube-proxy-wggdn           1/1       Running   0          3m
-system   kube-scheduler-92zrj       1/1       Running   0          3m
Command line

The full documentation is available here.

Quick run

 ./pupernetes run sandbox/

Graceful stop it with:

Quick systemd-run
 systemd-run ./pupernetes run ${PWD}/sandbox

Graceful stop it with:

Find any systemd-run unit with:

 systemctl list-units run-r*.service

The DESCRIPTION field should match the initial {COMMAND} [ARGS...]

Systemd as job type

It's possible to run pupernetes as a systemd service directly with the command line. In this case, pupernetes asks to be started with the given arguments. See more info about it in the run command.

Graceful stop it with:

Current limitations

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.