Files
lk/virtualization/kubernetes/proxy_api.md

932 B

title, tags, requires
title tags requires
Proxy API
virtualization
kubernetes
Kubernetes Basics

Start the proxy:

kubectl proxy &

Then curl the API server:

curl http://localhost:8001

Create a token:

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

Retrieve the API Server endpoint:

export APISERVER=$(kubectl config view | grep https | \
  cut -f 2- -d ":" | tr -d " ")

Confirm that the APISERVER variable stored the same IP as the Kubernetes control plane IP by issuing the following two commands and comparing their outputs:

echo $APISERVER

https://192.168.99.100:8443

kubectl cluster-info

We can also get the certs straight from the list in ~/.kube/config.