正常访问api需要token
curl `kubectl config view --minify |grep server |cut -f2- -d":" |tr -d " "`/api/v1 --header "Authorization: Bearer `kubectl describe secrets $(kubectl get secrets |grep ^default |cut -f1 -d" ") |grep -E '^token'|cut -d":" -f2 |tr -d " "`" --insecure
使用kubectl proxy后,不用token
kubectl proxy --port=8080
kubectl proxy --address='0.0.0.0' --accept-hosts='^*$' --port=8080
curl http://localhost:8080/api
curl -X GET -L http://k8s-master:8080/
创建service资源
kubectl create deploy nginx --image=nginx:latest --port=80 --replicas=3
kubectl expose deploy nginx --name=svc-nginx1 --type=ClusterIP --port=80 --target-port=80
curl http://k8s-master:8080/api/v1/namespaces/default/services/svc-nginx1