Deploying a local (development) Kubernetes environment

Vinícius Niche
2 min readSep 9, 2018

--

Because no one wants to test that script that can torn things apart on production, right?

Logo do Kubernetes

I’ll share how to use a shell script and what it does behind the curtains is commented on the source code, i've shared with my colleagues and personally use to deploy a local development Kubernetes (v1.10) master/node environment.

Requirements:

How to use:

$ curl -fsSL https://gist.githubusercontent.com/vniche/481cba7e6c16a413a3c60d7e6e81ea00/raw/523c6dd0d29f13662b4294bf2576594c114ff70d/local-dev.sh \
-o local-dev.sh
$ sh local-dev.sh

You will be asked for privilege escalation (a.k.a. run as root), as you can see below, sudo is used for many tasks (as Kubernetes requires).

What it does:

Summary:

Already addressed the whys of each step on their comments, but basically a Kubernetes single master (untainted as master in line #26 NOT FOR PRODUCTION!!) is started locally and soon after (5 min.) metrics services and dashboard are deployed, so you can see what and how yours and Kubernetes applications are running, so copy the token from the script output like shown above and:

...
Dashboard will ask for a Kubeconfig or Token to login, here is a cluster-admin token to use
token: ...MuaW8vc2VydmljZWFjY291bnQvc2VjcmV0Lm5hbWUiOiJsb2NhbC1hZG1pbi10b2tlbi16cWNudyIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VydmljZS1hY2NvdW50Lm5hbWUiOiJsb2NhbC1hZG1pbiIsImt1YmVybmV0ZXMuaW8...
$ kubectl proxy # let it running on background

and go to the Dashboard application.

A instance i ran for this story

Kubernetes experience wouldn’t be complete without metrics — required to use autoscaling and application behaviors analysis — and a more human-readable interface to see that information.

That’s all, feel free to contact me on any doubts, errors on the script or even non-related to this article stuff ✌️

--

--