base64 --decode works across Linux and MacOS (#17240)
Signed-off-by: Dr Nic Williams <drnicwilliams@gmail.com>pull/17292/head
parent
20694c79a9
commit
cdc590065c
|
@ -152,7 +152,7 @@ Unable to connect to the server: x509: certificate signed by unknown authority (
|
||||||
|
|
||||||
- Verify that the `$HOME/.kube/config` file contains a valid certificate, and
|
- Verify that the `$HOME/.kube/config` file contains a valid certificate, and
|
||||||
regenerate a certificate if necessary. The certificates in a kubeconfig file
|
regenerate a certificate if necessary. The certificates in a kubeconfig file
|
||||||
are base64 encoded. The `base64 -d` command can be used to decode the certificate
|
are base64 encoded. The `base64 --decode` command can be used to decode the certificate
|
||||||
and `openssl x509 -text -noout` can be used for viewing the certificate information.
|
and `openssl x509 -text -noout` can be used for viewing the certificate information.
|
||||||
- Unset the `KUBECONFIG` environment variable using:
|
- Unset the `KUBECONFIG` environment variable using:
|
||||||
|
|
||||||
|
|
|
@ -98,7 +98,7 @@ export CLUSTER_NAME="some_server_name"
|
||||||
APISERVER=$(kubectl config view -o jsonpath="{.clusters[?(@.name==\"$CLUSTER_NAME\")].cluster.server}")
|
APISERVER=$(kubectl config view -o jsonpath="{.clusters[?(@.name==\"$CLUSTER_NAME\")].cluster.server}")
|
||||||
|
|
||||||
# Gets the token value
|
# Gets the token value
|
||||||
TOKEN=$(kubectl get secrets -o jsonpath="{.items[?(@.metadata.annotations['kubernetes\.io/service-account\.name']=='default')].data.token}"|base64 -d)
|
TOKEN=$(kubectl get secrets -o jsonpath="{.items[?(@.metadata.annotations['kubernetes\.io/service-account\.name']=='default')].data.token}"|base64 --decode)
|
||||||
|
|
||||||
# Explore the API with TOKEN
|
# Explore the API with TOKEN
|
||||||
curl -X GET $APISERVER/api --header "Authorization: Bearer $TOKEN" --insecure
|
curl -X GET $APISERVER/api --header "Authorization: Bearer $TOKEN" --insecure
|
||||||
|
|
Loading…
Reference in New Issue