Access Kubernetes API

K3s’ installation create a kubeconfig.yaml file that contains the Kubernetes context that allows you to access the cluster.

$ export CLUSTER_NAME=master
$ export KUBECONFIG=distributions/k3s/_/docker/terraform/terraform.tfstate.d/$CLUSTER_NAME/kubeconfig.yaml
$ export BASE_DOMAIN=`docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' k3s-server-$CLUSTER_NAME|tr '.' '-'`.nip.io
$ kubectl get nodes
$ kubectl get namespaces
$ kubectl get pods --all-namespaces