Skip to main content
NetApp HCI Solutions

10. Enable access to the cluster with the GKE console

Contributors ac-ntap

After clusters are deployed and registered with Google Cloud, they must be logged into with the Google Cloud console to be managed and to receive additional cluster details. The official procedure to gain access to Anthos user clusters after they are deployed is detailed here.

Note The project and the specific user must be whitelisted to access on-premises clusters in the Google Cloud console and use Anthos on VMware services. If you are unable to see the clusters after they are deployed, you might need to open a support ticket with Google.

The non-whitelisted view looks like this:

Non-whitelisted view

The following figures provides a view of clusters.

View of clusters

To enable access to your user clusters using the GKE console, complete the following steps:

  1. Create a node-reader.yaml file that allows you to access the cluster.

    kind: clusterrole
     name: node-reader
    - apiGroups: [""]
      resources: ["nodes"]
      verbs: ["get", "list", "watch"]
  2. Apply this file to the cluster that you want to log into with the kubectl command.

    ubuntu@Anthos-Admin-Workstation:~$ kubectl apply -f node-reader.yaml --kubeconfig anthos-cluster01-kubeconfig created
  3. Create a Kubernetes service account (KSA) that you can use to log in. Name this account after the user that uses this account to log into the cluster.

    ubuntu@Anthos-Admin-Workstation:~$ kubectl create serviceaccount netapp-user --kubeconfig anthos-cluster01-kubeconfig
    serviceaccount/netapp-user created
  4. Create cluster role-binding resources to bind both the view and newly created node-reader roles to the newly created KSA.

    ubuntu@Anthos-Admin-Workstation:~$ kubectl create clusterrolebinding netapp-user-view --clusterrole view --serviceaccount default:netapp-user --kubeconfig anthos-cluster01-kubeconfig created
    ubuntu@Anthos-Admin-Workstation:~$ kubectl create clusterrolebinding netapp-user-node-reader --clusterrole node-reader -
    -serviceaccount default:netapp-user --kubeconfig anthos-cluster01-kubeconfig created
  5. If you need to extend permissions further, you can grant the KSA user a role with cluster admin permissions in a similar manner.

    ubuntu@Anthos-Admin-Workstation:~$ kubectl create clusterrolebinding netapp-user-admin --clusterrole cluster-admin --serviceaccount default:netapp-user --kubeconfig anthos-cluster01-kubeconfig created
  6. With the KSA account created and assigned with correct permissions, you can create a bearer token to allow access with the GKE Console. To do so, set a system variable for the secret name, and pass that variable through a kubectl command to generate the token.

    ubuntu@Anthos-Admin-Workstation:~$ SECRET_NAME=$(kubectl get serviceaccount netapp-user --kubeconfig anthos-cluster01-kubeconfig -o jsonpath='{$.secrets[0].name}')
    ubuntu@Anthos-Admin-Workstation:~$ kubectl get secret ${SECRET_NAME} --kubeconfig anthos-cluster01-kubeconfig -o jsonpath='{$.data.token}' | base64 -d
  7. With this token, you can visit the Google Cloud Console and log in to the cluster by clicking the login button and pasting in the token.

Log in to Google Cloud Console
  1. After login is complete, you see a green check mark next to the cluster name, and information is displayed about the physical environment. Clicking the cluster name displays more verbose information.

Kubernetes cluster details