k8s apiserver组件监控
KubeApiServer 监控实操 APIServer 在 Kubernetes 架构中非常核心,是所有 API 的入口,APIServer 也暴露了 metrics 数据,我们尝试获取一下: [root@dev01.nj etcd]# ss -tlpn|grep apiserver LISTEN 0 128 *:6443 *:* users:(("kube-apiserver",pid=164445,fd=7)) [root@dev01.nj etcd]# curl -s http://localhost:6443/metrics Client sent an HTTP request to an HTTPS server. [root@dev01.nj etcd]# curl -s -k https://localhost:6443/metrics { "kind": "Status", "apiVersion": "v1", "metadata": {}, "status": "Failure", "message": "forbidden: User \"system:anonymous\" cannot get path \"/metrics\"", "reason": "Forbidden", "details": {}, "code": 403 } 解释一下上面的命令和结果。首先我通过 ss 命令查看 apiserver 模块监听在哪些端口,发现这个进程在 6443 端口有监听。然后,使用 curl 命令请求 6443 的 metrics 接口,结果又说这是一个 HTTPS Server,不能用 HTTP 协议请求。好,那我用 HTTPS 协议请求,自签证书,加了 -k 参数,返回 Forbidden,说没权限访问 /metrics 接口。OK,那看来是需要 Token 鉴权,我们创建一下相关的 ServiceAccount。...