Kubernetes 中ListWatch机制通过websocket监听相关事件
示例
- ListWatch namespaces 变化接口
curl -i http://172.20.0.81:8080/api/v1/watch/namespaces?watch=yes
k8s api nginx 代理
cat k8s.conf
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 8081;
location / {
proxy_pass https://172.20.0.81:6443;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
访问:
curl -i http://172.20.0.81:8081/api/v1/watch/pods?watch=yes
最近更新
最新评论
加载中...