Installation

First the installation (of course you need to have docker installed and the kubectl cli).

Launch the following install script that will detect your processor architecture (386, amd64) and your OS (linux, darwin, windows) and then install the cli tool :

Create your first cluster:

k3d create --name dev --api-port 6551 --publish 8081:80

‘dev’ is the name of your Kubernetes that expose the api server port to 6551 and publish k3s node ports to the host on port 8081

Once created you can check the cluster status:

K3d list + — — — + — — — — — — — — — — — — — — — + — — — — -+ — — — — -+

| NAME | IMAGE | STATUS | WORKERS |

+ — — — + — — — — — — — — — — — — — — — + — — — — -+ — — — — -+

| dev | docker.io/rancher/k3s:v0.7.0 | running | 0/0 |

+ — — — + — — — — — — — — — — — — — — — + — — — — -+ — — — — -+

and to connect to it (the kubeconfig is stored in your user directory but it can easily be retrieved with a simple k3d command):

export KUBECONFIG="$(k3d get-kubeconfig --name='dev')"

kubectl cluster-info

kubectl get nodes NAME STATUS ROLES AGE VERSION

k3d-dev-server Ready master 6d1h v1.14.4-k3s.1

One missing piece is the metric server which is a cluster-wide aggregator of resource usage data. It collects metrics like CPU or memory consumption for containers or nodes, exposed by Kubelet on each node.

So, if you want to use k8s’ features like horizontal pod autoscaler or even to be able to use kubectl top command you need to use the metrics-server (which replace Heapster that was marked as deprecated with Kubernetes version 1.11 and retired in 1.13)

To install it :



kubectl apply -f metrics-server/deploy/1.8+/ git clone https://github.com/kubernetes-incubator/metrics-server.git kubectl apply -f metrics-server/deploy/1.8+/

Wait 1 or 2 minutes and then you can now use the following commands: