Fixes to example for connecting with curl (#9337)
* Fixes to example for connecting with curl Example for getting cluster token - does not work with multiple entries in kubeconfig - does not work with Istio installed Fix both * also need to change the tr from tabs to spaces
This commit is contained in:
@@ -77,11 +77,11 @@ $ curl http://localhost:8080/api/
|
||||
|
||||
### Without kubectl proxy
|
||||
|
||||
In Kubernetes version 1.3 or later, `kubectl config view` no longer displays the token. Use `kubectl describe secret...` to get the token for the default service account, like this:
|
||||
Use `kubectl describe secret...` to get the token for the default service account:
|
||||
|
||||
```shell
|
||||
$ APISERVER=$(kubectl config view | grep server | cut -f 2- -d ":" | tr -d " ")
|
||||
$ TOKEN=$(kubectl describe secret $(kubectl get secrets | grep default | cut -f1 -d ' ') | grep -E '^token' | cut -f2 -d':' | tr -d '\t')
|
||||
$ APISERVER=$(kubectl config view --minify | grep server | cut -f 2- -d ":" | tr -d " ")
|
||||
$ TOKEN=$(kubectl describe secret $(kubectl get secrets | grep ^default | cut -f1 -d ' ') | grep -E '^token' | cut -f2 -d':' | tr -d " ")
|
||||
$ curl $APISERVER/api --header "Authorization: Bearer $TOKEN" --insecure
|
||||
{
|
||||
"kind": "APIVersions",
|
||||
|
||||
Reference in New Issue
Block a user