Call Us! 1-800-383-5193
Call Us! 1-800-383-5193
Call Us! 1-800-383-5193

Need Help?

Emergency Response Time custom

Our experts have had an average response time of 11.06 minutes in March 2021 to fix urgent issues.

We will keep your servers stable, secure and fast at all times for one fixed price.

GKE OAuth authentication for User Authenticating – How to set up

by | Jul 5, 2021

Wondering how to set up GKE OAuth authentication for Authenticating users? We can help you.

In Google Kubernetes Engine (GKE), OAuth authentication is generally used for cluster authentication.

Here at Bobcares, we often handle requests from our customers to do this setup as a part of our Server Management Services.

Today we will see how our Support Engineers do this for our customers.

How to set up GKE OAuth authentication for Authenticating users

Now we will see the steps that our support Engineers follow.

As a prerequisite, we must ensure that the Google Kubernetes Engine API is enabled. We can do this using the following steps:

Enable Google Kubernetes Engine API

We must ensure that we have installed the Cloud SDK.

To set up default gcloud settings we can use one of the following methods:

  • gcloud init: if we wish to be walked through setting defaults.
  • gcloud config: If we wish to individually set the project ID, zone, and region.
Using gcloud init

1. In case if we receive the following error:

 One of [--zone, --region] must be supplied: Please specify location

We can complete this section and run gcloud init, follow the directions given below:

gcloud init

2. While doing SSH on a remote server, we caan use the ‘–console-only’ flag to prevent the command from launching a browser:

gcloud init --console-only

3. After that we can follow the instructions to authorize gcloud to use our Google Cloud account.

4. And create a new configuration or select an existing one.

5. Then choose a Google Cloud project.

6. We can choose a default Compute Engine zone for zonal clusters or a region for regional or Autopilot clusters.

Using gcloud config

1. First, we can set our default project ID using the following:

gcloud config set project PROJECT_ID

2. If we are working with zonal clusters, we can set our default compute zone using the following:

gcloud config set compute/zone COMPUTE_ZONE

3. And if we are working with Autopilot or regional clusters, we can set our default compute region using the following:

gcloud config set compute/region COMPUTE_REGION

4. Finally, we can update gcloud to the latest version with the following:

gcloud components update

Steps for Authenticating users using OAuth

GKE manages end-user authentication through the gcloud command-line tool.

The gcloud tool authenticates users to Google Cloud, sets up the Kubernetes configuration, gets an OAuth access token for the cluster, and keeps the access token up-to-date.

To authenticate to the cluster using the OAuth method, we must do the following:

1. Firstly, sign in to the gcloud tool using the credentials:

gcloud auth login 

Caution: This should not be performed on a Compute Engine VM. We must use a service account for authentication.

2. Then Retrieve the Kubernetes credentials for a specific cluster with the following:

gcloud container clusters get-credentials CLUSTER_NAME \     --zone=COMPUTE_ZONE

3. Finally we can verify that we are authenticated using the following:

kubectl cluster-info

[Need assistance? We can help you]


To conclude, we saw the steps that our Support Techs follow to


Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.


var google_conversion_label = "owonCMyG5nEQ0aD71QM";


Submit a Comment

Your email address will not be published. Required fields are marked *

Privacy Preference Center


Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]


Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid


Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie


These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.