首先,运行kubectl proxy
命令让apiServer在本地端口运行:
ubuntu@perf-calico-0:~$ kubectl proxy --port=8080 &
[1] 19016
Starting to serve on 127.0.0.1:8080
用-v
参数可以查看某个kubectl
命令的详细日志,从而找到某个api的http方法url:
ubuntu@perf-calico-0:~$ kbctl apply -f np -v 7
I1222 03:47:46.382302 30513 loader.go:375] Config loaded from file: /home/ubuntu/.kube/config
I1222 03:47:46.596496 30513 round_trippers.go:420] POST https://10.117.9.237:6443/apis/networking.k8s.io/v1/namespaces/default/networkpolicies
I1222 03:47:46.596523 30513 round_trippers.go:427] Request Headers:
I1222 03:47:46.596535 30513 round_trippers.go:431] User-Agent: kubectl/v1.18.12 (linux/amd64) kubernetes/7cd5e90
I1222 03:47:46.596550 30513 round_trippers.go:431] Accept: application/json
I1222 03:47:46.596563 30513 round_trippers.go:431] Content-Type: application/json
I1222 03:47:46.604439 30513 round_trippers.go:446] Response Status: 201 Created in 7 milliseconds
networkpolicy.networking.k8s.io/web-allow-external created
I1222 03:47:46.605635 30513 apply.go:393] Running apply post-processor function
ubuntu@perf-calico-0:~$ kbctl delete -f np -v 7
I1222 03:47:57.716249 30702 loader.go:375] Config loaded from file: /home/ubuntu/.kube/config
I1222 03:47:57.726138 30702 round_trippers.go:420] DELETE https://10.117.9.237:6443/apis/networking.k8s.io/v1/namespaces/default/networkpolicies/web-allow-external
I1222 03:47:57.726206 30702 round_trippers.go:427] Request Headers:
I1222 03:47:57.