企业主机安全 HSS-集群权限异常:解决办法

时间:2024-11-15 18:26:26

解决办法

  1. 登录集群任一节点目录。
  2. 创建hss-rbac.yaml文件,并将以下内容复制并保存至hss-rbac.yaml文件中。

    {"metadata":{"namespace":"hss","name":"hssRole"},"apiVersion":"rbac.authorization.k8s.io/v1","kind":"Role","rules":[{"resources":["configmaps"],"verbs":["create","delete","deletecollection","get","list","patch","update","watch"],"apiGroups":[""]},{"resources":["daemonsets","deployments","deployments/rollback","replicasets"],"verbs":["create","delete","deletecollection","get","list","patch","update","watch"],"apiGroups":["apps"]},{"resources":["cronjobs","jobs"],"verbs":["create","delete","deletecollection","get","list","patch","update","watch"],"apiGroups":["batch"]},{"resources":["ingresses"],"verbs":["create","delete","deletecollection","get","list","patch","update","watch"],"apiGroups":["extensions"]},{"resources":["ingresses"],"verbs":["create","delete","deletecollection","get","list","patch","update","watch"],"apiGroups":["networking.k8s.io"]}]}{"metadata":{"namespace":"hss","name":"hssRoleBinding"},"apiVersion":"rbac.authorization.k8s.io/v1","kind":"RoleBinding","subjects":[{"kind":"ServiceAccount","name":"hss-user","namespace":"hss"}],"roleRef":{"apiGroup":"rbac.authorization.k8s.io","kind":"Role","name":"hssRole"}}{"metadata":{"name":"hssClusterRole"},"apiVersion":"rbac.authorization.k8s.io/v1","kind":"ClusterRole","rules":[{"resources":["namespaces","pods","nodes","services","endpoints","configmaps","events","persistentvolumeclaims","persistentvolumes","podtemplates","replicationcontrollers","serviceaccounts","pods/log"],"verbs":["get","list"],"apiGroups":[""]},{"resources":["pods/status"],"verbs":["update"],"apiGroups":[""]},{"resources":["daemonsets","deployments","replicasets","statefulsets"],"verbs":["get","list"],"apiGroups":["apps"]},{"resources":["horizontalpodautoscalers"],"verbs":["get","list"],"apiGroups":["autoscaling"]},{"resources":["cronjobs","jobs"],"verbs":["get","list"],"apiGroups":["batch"]},{"resources":["endpointslices"],"verbs":["get","list"],"apiGroups":["discovery.k8s.io"]},{"resources":["events"],"verbs":["get","list"],"apiGroups":["events.k8s.io"]},{"resources":["ingresses"],"verbs":["get","list"],"apiGroups":["extensions"]},{"resources":["ingressclasses","ingresses","networkpolicies"],"verbs":["create","delete","update","get","list"],"apiGroups":["networking.k8s.io"]},{"resources":["clusterrolebindings","clusterroles","rolebindings","roles"],"verbs":["create","delete","deletecollection","patch","update","watch"],"apiGroups":["rbac.authorization.k8s.io"]},{"resources":["clusterrolebindings","clusterroles","rolebindings","roles"],"verbs":["get","list"],"apiGroups":["rbac.authorization.k8s.io"]},{"resources":["storageclasses","volumeattachments"],"verbs":["get","list"],"apiGroups":["storage.k8s.io"]}]}{"metadata":{"name":"hssClusterRoleBinding"},"apiVersion":"rbac.authorization.k8s.io/v1","kind":"ClusterRoleBinding","subjects":[{"kind":"ServiceAccount","name":"hss-user","namespace":"hss"}],"roleRef":{"apiGroup":"rbac.authorization.k8s.io","kind":"ClusterRole","name":"hssClusterRole"}}

  3. 执行以下命令,配置HSS所需的全量rbac权限

    kubectl apply -f hss-rbac.yaml

  4. 登录HSS控制台,查看权限列表中“是否有权限”列均为“是”,表示权限恢复正常,问题解决。

    详细操作请参考问题现象中查看权限列表的操作。

    如果您一直停留在HSS权限列表页面,请在配置完成后刷新下页面。

support.huaweicloud.com/hss2.0_faq/hss_01_0646.html