Prerequisites
- A valid email address
- A credit card for billing (GCP offers a free tier and $300 in free credits for new users)
- CRITICAL NOTE: If you just signed up for your account, you will need to activate your free credits by choosing the blue “Activate” button at the top right of the screen in order to be able to create a Kubernetes cluster, which requires 900 GB of SSD storage by default and trial accounts come with only 500 GBs.
Step 1: Create a GCP Account
- Go to the Google Cloud Platform website.
- Click on the Get started for free button.
- Follow the on-screen instructions to create a new Google account or sign in with an existing Google account.
- Set up your billing information to access the free tier and free credits.
Step 2: Set Up a New Project
- Once logged into the GCP Console, click on the Select a project dropdown at the top of the page.
- Click on New Project.
- Enter a project name, select a billing account, and choose a location.
- Click on Create.
Step 3: Enable the Kubernetes Engine API
- In the GCP Console, go to the Navigation menu > API & Services > Library.
- Search for Kubernetes Engine API.
- Click on Kubernetes Engine API and then click on Enable.
Step 4: Ensure Necessary Permissions
- As the owner of the project, you already have the necessary permissions to manage Artifact Registry repositories. If you are using a different account, ensure that it has the Editor role at the project level.
Step 5: Install and Configure Google Cloud SDK (gcloud CLI)
- Download and install the Google Cloud SDK.
- Open a terminal or command prompt.
- Initialize the SDK with the following command:
- Follow the on-screen prompts to log in with your Google account and set the default project.
Step 6: Authenticate the CLI Using Application-Default Login
- Authenticate the gcloud CLI with your user account:
Follow the on-screen prompts to log in with your Google account. This command sets up application-default credentials for the CLI.
Step 7: Create a Kubernetes Cluster
- Verify that the CLI is authenticated and can access the project:
- Verify that the Kubernetes Engine API is enabled:
- Ensure that you have the correct quotas set to create a new cluster. By default SSD_TOTAL_GB is set to 500 and a k8s cluster requies 900/
ssd
into the Filter search bar right above the quotas.
-
Create a new Kubernetes cluster:
Replace
CLUSTER_NAME
with the desired name of your cluster andZONE
with your preferred GCP zone. To see a list of existing zones typegcloud compute zones list
Step 8: Configure kubectl to Connect to Your Cluster
-
Get the credentials for your new cluster:
Replace
CLUSTER_NAME
andZONE
with the same values you used when creating the cluster. -
Verify that
kubectl
is configured correctly:This command should return a list of nodes in your cluster.
Additional Considerations: Quotas
By default, GCP provides sufficient quotas for most users. However, if you need to increase quotas for your project:- Go to the Navigation menu > IAM & Admin > Quotas.
- Filter by the quota you need to increase (e.g.,
In-use IP addresses in region
). - Select the quota and click on Edit Quotas.
- Fill out the request form and submit it. Google will review your request and notify you of the outcome.