A very simple approach to getting started is Minikube. Minikube is a single node Kubernetes cluster which should be sufficient for our use case here.
Note: Since we only need a working Kubernetes API you could also use any other cluster you like. I only tested this tutorial on K8S version 1.9.X, 1.10.X and 1.11.X.
Before you can install Minikube, you need to install the Kubernetes command line
client called kubectl
. You can get it here.
You need kubectl
because Minikube will setup a so called context
during startup.
A context
is like a pointer and can be very helpful when you need to manage
multiple Kubernetes clusters. You can switch between contexts
and point to
different clusters. In addition, Helm will also use your kubectl
config file to
find your minikube cluster...
Once you are done, please follow the instructions on the Minikube Github Page and install it. Please play attention to the dependencies of Minikube. When you are done, open a terminal and start Minikube.
minikube start
Starting local Kubernetes v1.10.0 cluster...
Starting VM...
Downloading Minikube ISO
160.27 MB / 160.27 MB [============================================] 100.00% 0s
Getting VM IP address...
Moving files into cluster...
Downloading kubeadm v1.10.0
Downloading kubelet v1.10.0
Finished Downloading kubelet v1.10.0
Finished Downloading kubeadm v1.10.0
Setting up certs...
Connecting to cluster...
Setting up kubeconfig...
Starting cluster components...
Kubectl is now configured to use the cluster.
Loading cached images from config file.
After starting Minikube, you should check if you can interact with the Kubernetes API:
kubectl get nodes
NAME STATUS ROLES AGE VERSION
minikube Ready master 47s v1.10.0
Let's also take a look at the running Pods:
kubectl get pods -o wide --all-namespaces
NAMESPACE NAME READY STATUS RESTARTS AGE IP NODE
kube-system etcd-minikube 1/1 Running 0 6m 10.0.2.15 minikube
kube-system kube-addon-manager-minikube 1/1 Running 0 6m 10.0.2.15 minikube
kube-system kube-apiserver-minikube 1/1 Running 0 5m 10.0.2.15 minikube
kube-system kube-controller-manager-minikube 1/1 Running 0 6m 10.0.2.15 minikube
kube-system kube-dns-86f4d74b45-dbtdx 3/3 Running 0 6m 172.17.0.2 minikube
kube-system kube-proxy-c9t76 1/1 Running 0 6m 10.0.2.15 minikube
kube-system kube-scheduler-minikube 1/1 Running 0 5m 10.0.2.15 minikube
kube-system kubernetes-dashboard-5498ccf677-x876c 1/1 Running 0 5m 172.17.0.3 minikube
kube-system storage-provisioner 1/1 Running 0 5m 10.0.2.15 minikube
To make this tutorial a little bit more realistic, we will create some Namespaces. A Namespace is a logical unit which I like to treat as different environments. I have already prepared some Namespaces for you. To create them, just execute:
kubectl apply -f part-01/templates/namespaces.yml
namespace/dev created
namespace/test created
namespace/prod created
namespace/tools created
Verify that everything is working as expected:
kubectl get namespaces
NAME STATUS AGE
default Active 12m
dev Active 41s
kube-public Active 11m
kube-system Active 12m
prod Active 41s
test Active 41s
tools Active 41s
Now you are ready to go on with Part II.