kube-api-auth 日志
W0402 03:19:13.786501 1 reflector.go:425] pkg/mod/github.com/rancher/client-go@v1.25.4-rancher1/tools/cache/reflector.go:170: failed to list *v3.ClusterUserAttribute: the server could not find the requested resource (get clusteruserattributes.meta.k8s.io)
2024-04-02T11:19:13.786689192+08:00 E0402 03:19:13.786528 1 reflector.go:141] pkg/mod/github.com/rancher/client-go@v1.25.4-rancher1/tools/cache/reflector.go:170: Failed to watch *v3.ClusterUserAttribute: failed to list *v3.ClusterUserAttribute: the server could not find the requested resource (get clusteruserattributes.meta.k8s.io)
rke2集群没有clusterauthtokens 资源
kubectl --kubeconfig=dev.yaml get clusterauthtokens -A
error: the server doesn’t have a resource type “clusterauthtokens”
kubectl get crd |grep clusterauthtokens
root@ip-172-31-8-202:~# kubectl --kubeconfig=demo.yaml get nodes
NAME STATUS ROLES AGE VERSION
ip-172-31-9-222 Ready control-plane,etcd,master,worker 12m v1.27.12+rke2r1
root@ip-172-31-8-202:~# kubectl --kubeconfig=demo.yaml config get-contexts
CURRENT NAME CLUSTER AUTHINFO NAMESPACE
* demo demo demo
demo-ip-172-31-9-222 demo-ip-172-31-9-222 demo
root@ip-172-31-8-202:~#
root@ip-172-31-8-202:~# kubectl --kubeconfig=demo.yaml get clusterauthtokens -A
error: the server doesn't have a resource type "clusterauthtokens"
切换到demo-ip-172-31-9-222 contexts 无法使用,我需要直接通过集群的节点连接,不走rancher的代理
E0402 16:21:35.703402 29732 memcache.go:265] couldn’t get current server API group list: the server has asked for the client to provide credentials
E0402 16:21:35.705065 29732 memcache.go:265] couldn’t get current server API group list: the server has asked for the client to provide credentials
E0402 16:21:35.706148 29732 memcache.go:265] couldn’t get current server API group list: the server has asked for the client to provide credentials
E0402 16:21:35.707172 29732 memcache.go:265] couldn’t get current server API group list: the server has asked for the client to provide credentials
E0402 16:21:35.708027 29732 memcache.go:265] couldn’t get current server API group list: the server has asked for the client to provide credentials
error: You must be logged in to the server (the server has asked for the client to provide credentials)
CURRENT NAME CLUSTER AUTHINFO NAMESPACE
yk-dev yk-dev yk-dev
yk-dev-sg-dev-yk-k8s-master-01-rke2 yk-dev-sg-dev-yk-k8s-master-01-rke2 yk-dev
yk-dev-sg-dev-yk-k8s-master-02-rke2 yk-dev-sg-dev-yk-k8s-master-02-rke2 yk-dev
* yk-dev-sg-dev-yk-k8s-master-03-rke2 yk-dev-sg-dev-yk-k8s-master-03-rke2 yk-dev
[root@sg-dev-yk-k8s-master-01-rke2 spadm]# /var/lib/rancher/rke2/bin/kubectl --kubeconfig yk-dev.yaml --context yk-dev-sg-dev-yk-k8s-master-03-rke2 get node
E0417 12:13:24.416990 1133467 memcache.go:265] couldn't get current server API group list: the server has asked for the client to provide credentials
E0417 12:13:24.419895 1133467 memcache.go:265] couldn't get current server API group list: the server has asked for the client to provide credentials
E0417 12:13:24.422547 1133467 memcache.go:265] couldn't get current server API group list: the server has asked for the client to provide credentials
E0417 12:13:24.425318 1133467 memcache.go:265] couldn't get current server API group list: the server has asked for the client to provide credentials
E0417 12:13:24.428502 1133467 memcache.go:265] couldn't get current server API group list: the server has asked for the client to provide credentials
error: You must be logged in to the server (the server has asked for the client to provide credentials)
上面是我没有使用 FQDN;
当我配置了 fqdn 的时候,并解析到其中一台 master 节点:
[root@sg-dev-yk-k8s-master-01-rke2 spadm]# /var/lib/rancher/rke2/bin/kubectl --kubeconfig yk-dev-fqdn.yaml config get-contexts
CURRENT NAME CLUSTER AUTHINFO NAMESPACE
yk-dev yk-dev yk-dev
* yk-dev-fqdn yk-dev-fqdn yk-dev
[root@sg-dev-yk-k8s-master-01-rke2 spadm]# /var/lib/rancher/rke2/bin/kubectl --kubeconfig yk-dev.yaml get node
E0417 11:25:19.482585 1080477 memcache.go:265] couldn't get current server API group list: Get "https://rancher-ace-yk-dev.ab.aaa/api?timeout=32s": dial tcp 10.65.23.14:443: connect: connection refused
E0417 11:25:19.490030 1080477 memcache.go:265] couldn't get current server API group list: Get "https://rancher-ace-yk-dev.ab.aaa/api?timeout=32s": dial tcp 10.65.23.14:443: connect: connection refused
E0417 11:25:19.496368 1080477 memcache.go:265] couldn't get current server API group list: Get "https://rancher-ace-yk-dev.ab.aaa/api?timeout=32s": dial tcp 10.65.23.14:443: connect: connection refused
E0417 11:25:19.541515 1080477 memcache.go:265] couldn't get current server API group list: Get "https://rancher-ace-yk-dev.ab.aaa/api?timeout=32s": dial tcp 10.65.23.14:443: connect: connection refused
E0417 11:25:19.547848 1080477 memcache.go:265] couldn't get current server API group list: Get "https://rancher-ace-yk-dev.ab.aaa/api?timeout=32s": dial tcp 10.65.23.14:443: connect: connection refused
The connection to the server rancher-ace-yk-dev.ab.aaa was refused - did you specify the right host or port?