Help Center/ Host Security Service/ FAQs/ Container Security/ What Do I Do If Cluster Permissions Are Abnormal?
Updated on 2024-11-15 GMT+08:00

What Do I Do If Cluster Permissions Are Abnormal?

Symptom

The third-party cloud cluster or on-premises cluster that has been connected to HSS does not have the permission to use the container-related functions provided by HSS.

To check permissions, perform the following steps:

  1. Log in to the management console.
  2. In the upper left corner of the page, select a region, click , and choose Security & Compliance > HSS.
  3. In the navigation pane, choose Installation & Configuration > Container Install & Config.
  4. Click the Cluster tab.
  5. Click the name of a cluster to go to the cluster node details page and view the permission list.

    If No is displayed in the Permissions Assigned column of a feature, you do not have the permission to use the feature.

Root Causes

A kubeconfig file dedicated to HSS is used by the third-party cloud cluster or on-premises cluster to connect to HSS, but this file is not configured by following the instructions in this document.

Solution

  1. Log in to a node in the cluster.
  2. Create the hss-rbac.yaml file. Copy and save the following content to the file:

    {"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. Run the following command to configure all RBAC permissions required by HSS:

    kubectl apply -f hss-rbac.yaml

  4. Log in to the HSS console and check whether the values in the Permissions Assigned column are Yes. If yes, the permissions are assigned and this fault is rectified.

    For details, see the operations for viewing the permission list in Symptom.

    If you stay on the HSS permission list page during troubleshooting, refresh the page after configuring the permissions.