使用kubectl proxy命令就可以使API server监听在本地的8001端口上:
$ kubectl proxy --port=8009 Starting to serve on 127.0.0.1:8009
如果想通过其它主机访问就需要指定监听的地址:
$ kubectl proxy --address=0.0.0.0 --port=8009 Starting to serve on [::]:8009
此时通过curl访问会出现未认证的提示:
$ curl -X GET -L http://k8s-master:8009/ <h3>Unauthorized</h3>
设置API server接收所有主机的请求:
$ kubectl proxy --address='0.0.0.0' --accept-hosts='^*$' --port=8009 Starting to serve on [::]:8009
文章转自:https://blog.csdn.net/jijiuqiu6646/article/details/106050201