[K8S:命令执行:权限异常:解决篇]:通过更新kubeconfig配置相关信息

这篇具有很好参考价值的文章主要介绍了[K8S:命令执行:权限异常:解决篇]:通过更新kubeconfig配置相关信息。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

一:场景复现:

1.1:关键信息:

执行K8S相关命令显示关键信息

Name: "calico-config", Namespace: "kube-system"
from server for: "calico.yaml": configmaps "calico-config" is forbidden: User "system:node:vboxnode3ccccccttttttchenyang" cannot ge API group "" in the namespace "kube-system": no relationship found between node 'vboxnode3ccccccttttttchenyang' and this object
Error from server (Forbidden): error when retrieving current configuration of:
Resource: "apiextensions.k8s.io/v1, Resource=customresourcedefinitions", GroupVersionKind: "apiextensions.k8s.io/v1, Kind=CustomRes
Name: "bgpconfigurations.crd.projectcalico.org", Namespace: ""
from server for: "calico.yaml": customresourcedefinitions.apiextensions.k8s.io "bgpconfigurations.crd.projectcalico.org" is forbiddnode3ccccccttttttchenyang" cannot get resource "customresourcedefinitions" in API group "apiextensions.k8s.io" at the cluster scope
Error from server (Forbidden): error when retrieving current configuration of:
Resource: "apiextensions.k8s.io/v1, Resource=customresourcedefinitions", GroupVersionKind: "apiextensions.k8s.io/v1, Kind=CustomRes
Name: "bgppeers.crd.projectcalico.org", Namespace: ""

1.2:全异常日志输出:

[root@vboxnode3ccccccttttttchenyang ~]# kubectl apply -f calico.yaml
^[[Aerror parsing calico.yaml: error converting YAML to JSON: yaml: line 153: found character that cannot start any token
Error from server (Forbidden): error when retrieving current configuration of:
Resource: "/v1, Resource=configmaps", GroupVersionKind: "/v1, Kind=ConfigMap"
Name: "calico-config", Namespace: "kube-system"
from server for: "calico.yaml": configmaps "calico-config" is forbidden: User "system:node:vboxnode3ccccccttttttchenyang" cannot ge API group "" in the namespace "kube-system": no relationship found between node 'vboxnode3ccccccttttttchenyang' and this object
Error from server (Forbidden): error when retrieving current configuration of:
Resource: "apiextensions.k8s.io/v1, Resource=customresourcedefinitions", GroupVersionKind: "apiextensions.k8s.io/v1, Kind=CustomRes
Name: "bgpconfigurations.crd.projectcalico.org", Namespace: ""
from server for: "calico.yaml": customresourcedefinitions.apiextensions.k8s.io "bgpconfigurations.crd.projectcalico.org" is forbiddnode3ccccccttttttchenyang" cannot get resource "customresourcedefinitions" in API group "apiextensions.k8s.io" at the cluster scope
Error from server (Forbidden): error when retrieving current configuration of:
Resource: "apiextensions.k8s.io/v1, Resource=customresourcedefinitions", GroupVersionKind: "apiextensions.k8s.io/v1, Kind=CustomRes
Name: "bgppeers.crd.projectcalico.org", Namespace: ""
from server for: "calico.yaml": customresourcedefinitions.apiextensions.k8s.io "bgppeers.crd.projectcalico.org" is forbidden: User ccttttttchenyang" cannot get resource "customresourcedefinitions" in API group "apiextensions.k8s.io" at the cluster scope
Error from server (Forbidden): error when retrieving current configuration of:
Resource: "apiextensions.k8s.io/v1, Resource=customresourcedefinitions", GroupVersionKind: "apiextensions.k8s.io/v1, Kind=CustomRes
Name: "blockaffinities.crd.projectcalico.org", Namespace: ""
from server for: "calico.yaml": customresourcedefinitions.apiextensions.k8s.io "blockaffinities.crd.projectcalico.org" is forbiddende3ccccccttttttchenyang" cannot get resource "customresourcedefinitions" in API group "apiextensions.k8s.io" at the cluster scope
Error from server (Forbidden): error when retrieving current configuration of:
Resource: "apiextensions.k8s.io/v1, Resource=customresourcedefinitions", GroupVersionKind: "apiextensions.k8s.io/v1, Kind=CustomRes
Name: "caliconodestatuses.crd.projectcalico.org", Namespace: ""
from server for: "calico.yaml": customresourcedefinitions.apiextensions.k8s.io "caliconodestatuses.crd.projectcalico.org" is forbidxnode3ccccccttttttchenyang" cannot get resource "customresourcedefinitions" in API group "apiextensions.k8s.io" at the cluster scop
Error from server (Forbidden): error when retrieving current configuration of:
Resource: "apiextensions.k8s.io/v1, Resource=customresourcedefinitions", GroupVersionKind: "apiextensions.k8s.io/v1, Kind=CustomRes
Name: "clusterinformations.crd.projectcalico.org", Namespace: ""
from server for: "calico.yaml": customresourcedefinitions.apiextensions.k8s.io "clusterinformations.crd.projectcalico.org" is forbioxnode3ccccccttttttchenyang" cannot get resource "customresourcedefinitions" in API group "apiextensions.k8s.io" at the cluster sco
Error from server (Forbidden): error when retrieving current configuration of:
Resource: "apiextensions.k8s.io/v1, Resource=customresourcedefinitions", GroupVersionKind: "apiextensions.k8s.io/v1, Kind=CustomRes
Name: "felixconfigurations.crd.projectcalico.org", Namespace: ""
from server for: "calico.yaml": customresourcedefinitions.apiextensions.k8s.io "felixconfigurations.crd.projectcalico.org" is forbioxnode3ccccccttttttchenyang" cannot get resource "customresourcedefinitions" in API group "apiextensions.k8s.io" at the cluster sco
Error from server (Forbidden): error when retrieving current configuration of:
Resource: "apiextensions.k8s.io/v1, Resource=customresourcedefinitions", GroupVersionKind: "apiextensions.k8s.io/v1, Kind=CustomRes
Name: "globalnetworkpolicies.crd.projectcalico.org", Namespace: ""
from server for: "calico.yaml": customresourcedefinitions.apiextensions.k8s.io "globalnetworkpolicies.crd.projectcalico.org" is forvboxnode3ccccccttttttchenyang" cannot get resource "customresourcedefinitions" in API group "apiextensions.k8s.io" at the cluster s
Error from server (Forbidden): error when retrieving current configuration of:
Resource: "apiextensions.k8s.io/v1, Resource=customresourcedefinitions", GroupVersionKind: "apiextensions.k8s.io/v1, Kind=CustomRes
Name: "globalnetworksets.crd.projectcalico.org", Namespace: ""
from server for: "calico.yaml": customresourcedefinitions.apiextensions.k8s.io "globalnetworksets.crd.projectcalico.org" is forbiddnode3ccccccttttttchenyang" cannot get resource "customresourcedefinitions" in API group "apiextensions.k8s.io" at the cluster scope
Error from server (Forbidden): error when retrieving current configuration of:
Resource: "apiextensions.k8s.io/v1, Resource=customresourcedefinitions", GroupVersionKind: "apiextensions.k8s.io/v1, Kind=CustomRes
Name: "hostendpoints.crd.projectcalico.org", Namespace: ""
from server for: "calico.yaml": customresourcedefinitions.apiextensions.k8s.io "hostendpoints.crd.projectcalico.org" is forbidden: 3ccccccttttttchenyang" cannot get resource "customresourcedefinitions" in API group "apiextensions.k8s.io" at the cluster scope
Error from server (Forbidden): error when retrieving current configuration of:
Resource: "apiextensions.k8s.io/v1, Resource=customresourcedefinitions", GroupVersionKind: "apiextensions.k8s.io/v1, Kind=CustomRes
Name: "ipamblocks.crd.projectcalico.org", Namespace: ""
from server for: "calico.yaml": customresourcedefinitions.apiextensions.k8s.io "ipamblocks.crd.projectcalico.org" is forbidden: Useccccttttttchenyang" cannot get resource "customresourcedefinitions" in API group "apiextensions.k8s.io" at the cluster scope
Error from server (Forbidden): error when retrieving current configuration of:
Resource: "apiextensions.k8s.io/v1, Resource=customresourcedefinitions", GroupVersionKind: "apiextensions.k8s.io/v1, Kind=CustomRes
Name: "ipamconfigs.crd.projectcalico.org", Namespace: ""
from server for: "calico.yaml": customresourcedefinitions.apiextensions.k8s.io "ipamconfigs.crd.projectcalico.org" is forbidden: Uscccccttttttchenyang" cannot get resource "customresourcedefinitions" in API group "apiextensions.k8s.io" at the cluster scope
Error from server (Forbidden): error when retrieving current configuration of:
Resource: "apiextensions.k8s.io/v1, Resource=customresourcedefinitions", GroupVersionKind: "apiextensions.k8s.io/v1, Kind=CustomRes
Name: "ipamhandles.crd.projectcalico.org", Namespace: ""
from server for: "calico.yaml": customresourcedefinitions.apiextensions.k8s.io "ipamhandles.crd.projectcalico.org" is forbidden: Uscccccttttttchenyang" cannot get resource "customresourcedefinitions" in API group "apiextensions.k8s.io" at the cluster scope
Error from server (Forbidden): error when retrieving current configuration of:
Resource: "apiextensions.k8s.io/v1, Resource=customresourcedefinitions", GroupVersionKind: "apiextensions.k8s.io/v1, Kind=CustomRes
Name: "ippools.crd.projectcalico.org", Namespace: ""
from server for: "calico.yaml": customresourcedefinitions.apiextensions.k8s.io "ippools.crd.projectcalico.org" is forbidden: User "cttttttchenyang" cannot get resource "customresourcedefinitions" in API group "apiextensions.k8s.io" at the cluster scope
Error from server (Forbidden): error when retrieving current configuration of:
Resource: "apiextensions.k8s.io/v1, Resource=customresourcedefinitions", GroupVersionKind: "apiextensions.k8s.io/v1, Kind=CustomRes
Name: "ipreservations.crd.projectcalico.org", Namespace: ""
from server for: "calico.yaml": customresourcedefinitions.apiextensions.k8s.io "ipreservations.crd.projectcalico.org" is forbidden:e3ccccccttttttchenyang" cannot get resource "customresourcedefinitions" in API group "apiextensions.k8s.io" at the cluster scope
Error from server (Forbidden): error when retrieving current configuration of:
Resource: "apiextensions.k8s.io/v1, Resource=customresourcedefinitions", GroupVersionKind: "apiextensions.k8s.io/v1, Kind=CustomRes
Name: "kubecontrollersconfigurations.crd.projectcalico.org", Namespace: ""
from server for: "calico.yaml": customresourcedefinitions.apiextensions.k8s.io "kubecontrollersconfigurations.crd.projectcalico.orgem:node:vboxnode3ccccccttttttchenyang" cannot get resource "customresourcedefinitions" in API group "apiextensions.k8s.io" at the c
Error from server (Forbidden): error when retrieving current configuration of:
Resource: "apiextensions.k8s.io/v1, Resource=customresourcedefinitions", GroupVersionKind: "apiextensions.k8s.io/v1, Kind=CustomRes
Name: "networkpolicies.crd.projectcalico.org", Namespace: ""
from server for: "calico.yaml": customresourcedefinitions.apiextensions.k8s.io "networkpolicies.crd.projectcalico.org" is forbiddende3ccccccttttttchenyang" cannot get resource "customresourcedefinitions" in API group "apiextensions.k8s.io" at the cluster scope
Error from server (Forbidden): error when retrieving current configuration of:
Resource: "apiextensions.k8s.io/v1, Resource=customresourcedefinitions", GroupVersionKind: "apiextensions.k8s.io/v1, Kind=CustomRes
Name: "networksets.crd.projectcalico.org", Namespace: ""
from server for: "calico.yaml": customresourcedefinitions.apiextensions.k8s.io "networksets.crd.projectcalico.org" is forbidden: Uscccccttttttchenyang" cannot get resource "customresourcedefinitions" in API group "apiextensions.k8s.io" at the cluster scope
Error from server (Forbidden): error when retrieving current configuration of:
Resource: "rbac.authorization.k8s.io/v1, Resource=clusterroles", GroupVersionKind: "rbac.authorization.k8s.io/v1, Kind=ClusterRole"
Name: "calico-kube-controllers", Namespace: ""
from server for: "calico.yaml": clusterroles.rbac.authorization.k8s.io "calico-kube-controllers" is forbidden: User "system:node:vbg" cannot get resource "clusterroles" in API group "rbac.authorization.k8s.io" at the cluster scope
Error from server (Forbidden): error when retrieving current configuration of:
Resource: "rbac.authorization.k8s.io/v1, Resource=clusterrolebindings", GroupVersionKind: "rbac.authorization.k8s.io/v1, Kind=Clust
Name: "calico-kube-controllers", Namespace: ""
from server for: "calico.yaml": clusterrolebindings.rbac.authorization.k8s.io "calico-kube-controllers" is forbidden: User "system:chenyang" cannot get resource "clusterrolebindings" in API group "rbac.authorization.k8s.io" at the cluster scope
Error from server (Forbidden): error when retrieving current configuration of:
Resource: "rbac.authorization.k8s.io/v1, Resource=clusterroles", GroupVersionKind: "rbac.authorization.k8s.io/v1, Kind=ClusterRole"
Name: "calico-node", Namespace: ""
from server for: "calico.yaml": clusterroles.rbac.authorization.k8s.io "calico-node" is forbidden: User "system:node:vboxnode3ccccct resource "clusterroles" in API group "rbac.authorization.k8s.io" at the cluster scope
Error from server (Forbidden): error when retrieving current configuration of:
Resource: "rbac.authorization.k8s.io/v1, Resource=clusterrolebindings", GroupVersionKind: "rbac.authorization.k8s.io/v1, Kind=Clust
Name: "calico-node", Namespace: ""
from server for: "calico.yaml": clusterrolebindings.rbac.authorization.k8s.io "calico-node" is forbidden: User "system:node:vboxnodnnot get resource "clusterrolebindings" in API group "rbac.authorization.k8s.io" at the cluster scope

二:解决流程:

2.1:更新 kubeconfig:

2.1.1:执行命令:

export KUBECONFIG=/root/.kube/config
chmod g-r /root/.kube/config

2.2:再次执行之前的异常命令:

[root@vboxnode3ccccccttttttchenyang ~]#  kubectl get deployment
Unable to connect to the server: x509: certificate signed by unknown authority (possibly because of "crypto/rsa: verification error" while trying to verify candidate authority certificate "kubernetes")
[root@vboxnode3ccccccttttttchenyang ~]# kubectl apply -f calico.yaml
Unable to connect to the server: x509: certificate signed by unknown authority (possibly because of "crypto/rsa: verification error" while trying to verify candidate authority certificate "kubernetes")

error from server (forbidden): error when retrieving current configuration o,# 服务器,# Kubernetes-K8S,运维,kubernetes,linux,容器

2.3:k8s配置操作config相关命令:

这一步应该在安装K8S kubeadm init后面执行,之前安装忘记这一步。

 mkdir -p $HOME/.kube
 sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
 sudo chown $(id -u):$(id -g) $HOME/.kube/config

[root@vboxnode3ccccccttttttchenyang ~]# mkdir -p $HOME/.kube
[root@vboxnode3ccccccttttttchenyang ~]#
[root@vboxnode3ccccccttttttchenyang ~]# sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
cp:是否覆盖"/root/.kube/config"? y
[root@vboxnode3ccccccttttttchenyang ~]# sudo chown ( i d − u ) : (id -u): (idu):(id -g) $HOME/.kube/config
在这里插入图片描述
error from server (forbidden): error when retrieving current configuration o,# 服务器,# Kubernetes-K8S,运维,kubernetes,linux,容器

2.4:重新执行之前操作失效命令:

可以看见都已经生效:

kubectl get nodes -o wide
kubectl apply -f calico.yaml
[root@vboxnode3ccccccttttttchenyang ~]# kubectl get nodes -o wide
NAME                            STATUS     ROLES                  AGE   VERSION   INTERNAL-IP      EXTERNAL-IP   OS-IMAGE                KERNEL-VERSION                CONTAINER-RUNTIME
chenyang-mine-vbox02            NotReady   <none>                 19h   v1.21.0   192.168.56.102   <none>        CentOS Linux 7 (Core)   3.10.0-1160.88.1.el7.x86_64   docker://23.0.5
vboxnode3ccccccttttttchenyang   NotReady   control-plane,master   19h   v1.21.0   192.168.56.103   <none>        CentOS Linux 7 (Core)   3.10.0-1160.90.1.el7.x86_64   docker://23.0.5
[root@vboxnode3ccccccttttttchenyang ~]# kubectl apply -f calico.yaml
configmap/calico-config created
customresourcedefinition.apiextensions.k8s.io/bgpconfigurations.crd.projectcalico.org created
customresourcedefinition.apiextensions.k8s.io/bgppeers.crd.projectcalico.org created
customresourcedefinition.apiextensions.k8s.io/blockaffinities.crd.projectcalico.org created
customresourcedefinition.apiextensions.k8s.io/caliconodestatuses.crd.projectcalico.org created
customresourcedefinition.apiextensions.k8s.io/clusterinformations.crd.projectcalico.org created
customresourcedefinition.apiextensions.k8s.io/felixconfigurations.crd.projectcalico.org created
customresourcedefinition.apiextensions.k8s.io/globalnetworkpolicies.crd.projectcalico.org created
customresourcedefinition.apiextensions.k8s.io/globalnetworksets.crd.projectcalico.org created
customresourcedefinition.apiextensions.k8s.io/hostendpoints.crd.projectcalico.org created
customresourcedefinition.apiextensions.k8s.io/ipamblocks.crd.projectcalico.org created
customresourcedefinition.apiextensions.k8s.io/ipamconfigs.crd.projectcalico.org created
customresourcedefinition.apiextensions.k8s.io/ipamhandles.crd.projectcalico.org created
customresourcedefinition.apiextensions.k8s.io/ippools.crd.projectcalico.org created
customresourcedefinition.apiextensions.k8s.io/ipreservations.crd.projectcalico.org created
customresourcedefinition.apiextensions.k8s.io/kubecontrollersconfigurations.crd.projectcalico.org created
customresourcedefinition.apiextensions.k8s.io/networkpolicies.crd.projectcalico.org created
customresourcedefinition.apiextensions.k8s.io/networksets.crd.projectcalico.org created
clusterrole.rbac.authorization.k8s.io/calico-kube-controllers created
clusterrolebinding.rbac.authorization.k8s.io/calico-kube-controllers created
clusterrole.rbac.authorization.k8s.io/calico-node created
clusterrolebinding.rbac.authorization.k8s.io/calico-node created
error: error parsing calico.yaml: error converting YAML to JSON: yaml: line 153: found character that cannot start any token
[root@vboxnode3ccccccttttttchenyang ~]#

error from server (forbidden): error when retrieving current configuration o,# 服务器,# Kubernetes-K8S,运维,kubernetes,linux,容器

2.5:[解决]:重新启动机器后发现kubectl apply -f相关命令又失效无权限相关:

2.5.1:异常日志显示:

[root@vboxnode3ccccccttttttchenyang ~]# vim calico.yaml
-bash: vim: 未找到命令
[root@vboxnode3ccccccttttttchenyang ~]# vi calico.yaml
[root@vboxnode3ccccccttttttchenyang ~]# kubectl apply -f calico.yaml
Error from server (Forbidden): error when retrieving current configuration of:
Resource: "policy/v1, Resource=poddisruptionbudgets", GroupVersionKind: "policy/v1, Kind=PodDisruptionBudget"
Name: "calico-kube-controllers", Namespace: "kube-system"
from server for: "calico.yaml": poddisruptionbudgets.policy "calico-kube-controllers" is forbidden: User "system:node:vboxnode3cccc                                                                 ccttttttchenyang" cannot get resource "poddisruptionbudgets" in API group "policy" in the namespace "kube-system"
Error from server (Forbidden): error when retrieving current configuration of:
Resource: "/v1, Resource=serviceaccounts", GroupVersionKind: "/v1, Kind=ServiceAccount"
Name: "calico-kube-controllers", Namespace: "kube-system"
from server for: "calico.yaml": serviceaccounts "calico-kube-controllers" is forbidden: User "system:node:vboxnode3ccccccttttttchen                                                                 yang" cannot get resource "serviceaccounts" in API group "" in the namespace "kube-system": can only create tokens for individual s                                                                 ervice accounts
Error from server (Forbidden): error when retrieving current configuration of:
Resource: "/v1, Resource=serviceaccounts", GroupVersionKind: "/v1, Kind=ServiceAccount"
Name: "calico-node", Namespace: "kube-system"
from server for: "calico.yaml": serviceaccounts "calico-node" is forbidden: User "system:node:vboxnode3ccccccttttttchenyang" cannot                                                                  get resource "serviceaccounts" in API group "" in the namespace "kube-system": can only create tokens for individual service accou                                                                 nts

error from server (forbidden): error when retrieving current configuration o,# 服务器,# Kubernetes-K8S,运维,kubernetes,linux,容器

2.5.2:解决方式:执行export KUBECONFIG=/root/.kube/config / chmod g-r /root/.kube/config

export KUBECONFIG=/root/.kube/config
chmod g-r /root/.kube/config
kubectl apply -f calico.yaml

[root@vboxnode3ccccccttttttchenyang ~]# export KUBECONFIG=/root/.kube/config
[root@vboxnode3ccccccttttttchenyang ~]# chmod g-r /root/.kube/config
[root@vboxnode3ccccccttttttchenyang ~]# kubectl apply -f calico.yaml

kubectl delete pod coredns-545d6fc579-6ddhj coredns-545d6fc579-nkk68 -n kube-system

[root@vboxnode3ccccccttttttchenyang ~]# export KUBECONFIG=/root/.kube/config
[root@vboxnode3ccccccttttttchenyang ~]# chmod g-r /root/.kube/config
[root@vboxnode3ccccccttttttchenyang ~]# kubectl apply -f calico.yaml
poddisruptionbudget.policy/calico-kube-controllers created
serviceaccount/calico-kube-controllers created
serviceaccount/calico-node created
configmap/calico-config unchanged
customresourcedefinition.apiextensions.k8s.io/bgpconfigurations.crd.projectcalico.org configured
customresourcedefinition.apiextensions.k8s.io/bgppeers.crd.projectcalico.org configured
customresourcedefinition.apiextensions.k8s.io/blockaffinities.crd.projectcalico.org configured
customresourcedefinition.apiextensions.k8s.io/caliconodestatuses.crd.projectcalico.org configured
customresourcedefinition.apiextensions.k8s.io/clusterinformations.crd.projectcalico.org configured
customresourcedefinition.apiextensions.k8s.io/felixconfigurations.crd.projectcalico.org configured
customresourcedefinition.apiextensions.k8s.io/globalnetworkpolicies.crd.projectcalico.org configured
customresourcedefinition.apiextensions.k8s.io/globalnetworksets.crd.projectcalico.org configured
customresourcedefinition.apiextensions.k8s.io/hostendpoints.crd.projectcalico.org configured
customresourcedefinition.apiextensions.k8s.io/ipamblocks.crd.projectcalico.org configured
customresourcedefinition.apiextensions.k8s.io/ipamconfigs.crd.projectcalico.org configured
customresourcedefinition.apiextensions.k8s.io/ipamhandles.crd.projectcalico.org configured
customresourcedefinition.apiextensions.k8s.io/ippools.crd.projectcalico.org configured
customresourcedefinition.apiextensions.k8s.io/ipreservations.crd.projectcalico.org configured
customresourcedefinition.apiextensions.k8s.io/kubecontrollersconfigurations.crd.projectcalico.org configured
customresourcedefinition.apiextensions.k8s.io/networkpolicies.crd.projectcalico.org configured
customresourcedefinition.apiextensions.k8s.io/networksets.crd.projectcalico.org configured
clusterrole.rbac.authorization.k8s.io/calico-kube-controllers configured
clusterrole.rbac.authorization.k8s.io/calico-node configured
clusterrolebinding.rbac.authorization.k8s.io/calico-kube-controllers unchanged
clusterrolebinding.rbac.authorization.k8s.io/calico-node unchanged
daemonset.apps/calico-node created
deployment.apps/calico-kube-controllers created
[root@vboxnode3ccccccttttttchenyang ~]#

error from server (forbidden): error when retrieving current configuration o,# 服务器,# Kubernetes-K8S,运维,kubernetes,linux,容器文章来源地址https://www.toymoban.com/news/detail-775544.html

到了这里,关于[K8S:命令执行:权限异常:解决篇]:通过更新kubeconfig配置相关信息的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • k8s 实战 常见异常事件 event 及解决方案分享

    重启集群中的coredns组件发生重启(重新创建),一般是由于coredns组件压力较大导致oom,请检查业务是否异常,是否存在应用容器无法解析域名的异常。 如果是local-dns重启,说明local-dns的性能也不够了,需要优化 云应用容器实例发生OOM,请检查云应用是否正常。一般地,如果云

    2023年04月09日
    浏览(34)
  • 如何通过port-forward命令在本地访问 k8s 集群服务

    公众号「架构成长指南」,专注于生产实践、云原生、分布式系统、大数据技术分享 在我们访问k8s中的pod服务时,一般通过node port映射pod端口进行访问,还有一种是通过ingress或者istio通过域名方式来访问,虽然两种方式能满足我们需求,但是如果针对临时访问,配置起来还是

    2024年02月04日
    浏览(61)
  • k8s基础:使用kubectl set image命令更新Deployment中容器的镜像

    在Kubernetes中,使用 kubectl 更新Deployment中容器的镜像,可以使用以下命令: 例如,如果你有一个名为 myapp 的 Deployment,其中包含一个名为 mycontainer 的容器,你想将镜像从 myregistry/myimage:v1 更新到 myregistry/myimage:v2 ,可以执行: 这条命令将会触发一个滚动更新,根据你的Deploy

    2024年04月26日
    浏览(44)
  • K8s中内置的Prometheus 异常,不断重启的解决方案

    要说明的一点是: 此处理方式会进行数据的删除 ,并且多实例情况下最好都做下操作。多实例都操作一遍的意思就是比如我普罗米修斯有如下四个: 如果Prometheus-k8s-0一直重启,则不光需要操作Prometheus-k8s-0,也需要对它的另一个实例Prometheus-k8s-1进行处理。如果是Prometheus-k

    2024年02月15日
    浏览(54)
  • K8s 生产环境问题汇总及解决方案(持续更新 ing)

    目录 一、前端页面显示 503 Service Temporarily Unavailable 问题背景 解决方案 原理 二、Dockfile 构建镜像失败:When using COPY with more than one source file, the destination must be a directory and end with a /  问题背景 解决方案 原理 三、前端页面显示 502 Bad Gateway 问题背景  解决方案 原理 时间:2

    2024年02月02日
    浏览(39)
  • 通过containerd部署k8s集群环境及初始化时部分报错解决

    目录 一.基础环境配置(每个节点都做) 1.hosts解析 2.防火墙和selinux 3.安装基本软件并配置时间同步 4.禁用swap分区 5.更改内核参数 6.配置ipvs 7.k8s下载 (1)配置镜像下载相关软件 (2)配置kubelet上的cgroup 二.下载containerd(每个节点都做) 1.下载基本软件 2.添加软件仓库信息 3.更

    2024年02月07日
    浏览(48)
  • k8s-权限管理

    我们在目前的k8s集群环境里面,只能在master节点上执行kubectl的一些命令,在其他节点上执行就会报错 我们可以看到在node1上执行kubectl get nodes都会报错,那就更不谈创建pod之类的操作了,那为什么master可以而其他节点不行呢?这是因为在master节点上是有一个kubeconfig的 我们可

    2024年02月22日
    浏览(37)
  • K8S学习指南(37)-k8s权限管理对象User

    在Kubernetes(K8s)中,用户(User)是一个重要的权限管理对象,用于表示在集群中执行操作的实体。通过用户,Kubernetes能够对集群中的各种资源进行身份验证和授权。本文将深入研究Kubernetes中的用户对象,包括其基本概念、创建方式以及详细示例。 1. 用户是什么? 在Kubern

    2024年01月23日
    浏览(42)
  • K8S集群Token过期处理方法以及Kubectl命令无法使用的问题解决

    使用Kubeadm方式部署的K8S集群,在初始化的时候生成的Token的有效期为1天,当过期之后Token就无法使用了,也就意味着,在Node节点执行 kubeadm join 命令加入K8S集群时就会失败,可以通过下面的方法重新生成Token。 1)创建Token

    2024年02月16日
    浏览(40)
  • k8s kubectl 启动成功,但执行命令时报错:The connection to the server localhost:8080 was refused - did you specify

    node2 systemctl start kubectl 后可以正常启动服务,systemctl ststus kubectl 也显示running。但是执行 kubectl cluster-info 或  kubectl get pod 均报错:The connection to the server localhost:8080 was refused - did you specify the right host or port 怀疑是重启服务之前 ~/.kube/config 被测试进行修改后导致报错 首先查看

    2024年03月12日
    浏览(61)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包