kubectl proxy
# kubectl proxy
为 Kubernetes API 启用一个本地代理,你可以通过该代理来访问所有 Kubernetes 资源。
1、运行以下命令,在本地的8080
端口启用代理。
kubectl proxy --port=8080 &
1
2、然后你可以访问http://localhost:8080
,通过 Kubernetes API 访问和操作集群。
➜ curl http://localhost:8080/api/
{
"kind": "APIVersions",
"versions": [
"v1"
],
"serverAddressByClientCIDRs": [
{
"clientCIDR": "0.0.0.0/0",
"serverAddress": "192.168.80.10:6443"
}
]
}
1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13
编辑 (opens new window)