Skip to content

Accessing minikube

APIs:

  • /api/v1 - core group:  Pods, Services, Nodes, Namespaces, ConfigMaps, Secrets, etc
  • /apis/$NAME/$VERSION - named group
  • system-wide: /healthz/logs/metrics/ui, etc Access to API server:
  • CLI tools
  • Dashboard UI
  • Calling API endpoints

kubectl

Allows to manage Kubernetes clusters. Details here kubectl book, the Kubernetes official documentation, or its GitHub repository.

Installing kubectl on macOS

install

kubectl config view
kubectl cluster-info

Kubernetes Dashboard

  • it is addon
  • disabled by default.
minikube addons list
minikube addons enable metrics-server
minikube addons enable dashboard
minikube dashboard

APIs with 'kubectl proxy'

 kubectl proxy &
curl http://localhost:8001/

Authentication

Let's get request without kubectl proxy.

export TOKEN=$(kubectl create token default)

kubectl create clusterrole api-access-root --verb=get --non-resource-url="/*"
kubectl create clusterrolebinding api-access-root --clusterrole api-access-root --serviceaccount=default:default
export APISERVER=$(kubectl config view | grep https | cut -f 2- -d ":" | tr -d " ")

curl $APISERVER --header "Authorization:** **Bearer $TOKEN" --insecure
Or you can use authentication with certificate:
curl $APISERVER --cert encoded-cert --key encoded-key --cacert encoded-ca

References

  1. LinuxFoundationX LFS158x.1. Chapter 7. Accessing Minikube