Think before you speak, read before you think.

k8s 容器内访问 apiserver

kubectl exec -it cassandra-0  bash -n noah

TOKEN=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token)

curl https://kubernetes.default.svc.cluster.local/api/v1/namespaces/noah/endpoints/cassandra --header "Authorization: Bearer $TOKEN" --cacert /var/run/secrets/kubernetes.io/serviceaccount/ca.crt


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *