Overview 🔗︎
Kubernetes Engine (GKE) is a managed, production-ready environment for deploying containerized applications.
This quickstart will guide you through the steps needed to set up a GKE cluster with Banzai Cloud Pipeline.
Prerequisites 🔗︎
- Google credentials json file
- Banzai CLI tool authenticated against the Pipeline instance
Create a Google secret 🔗︎
In order to access resources on Google Cloud, the appropriate credentials need to be registered in the Banzai Cloud Pipeline’s secret store. (The reference to this secret will be used later on instead of passing the credentials around)
Follow this guide to create GKE credentials
The values needed for the secret are available in the google credential json file. Issue the command below to register your secret in Pipeline (replace the content with the values from your google credentials json!)
banzai secret create <<EOF
{
"name": "google-secret",
"type": "google",
"values": {
"type": "service_account",
"project_id": "{{google-project-id}}",
"private_key_id": "{{private-key-id}}",
"private_key": "{{private-key}}",
"client_email": "{{client-email}}",
"client_id": "{{client-id}}",
"auth_uri": "{{auth-uri}}",
"token_uri": "{{token-uri}}",
"auth_provider_x509_cert_url": "{{auth-provider-x509-cert-url}}",
"client_x509_cert_url": "{{client-x509-cert-url}}"
}
}
EOF
Id Name Type UpdatedBy Tags
b32343e28d37e09c26d91b4271eaa8dd689b16d9f1aba07fdc73af2a27750309 google-secret google lpuskas []
Create GKE clusters 🔗︎
Use the secret ID from the previous command!
You can check the available regions and instance types in our Cloudinfo service.
Create a 3 node GKE cluster 🔗︎
The command below creates a 3 node GKE cluster (that the master node is provided by the GKE service)
banzai cluster create <<EOF
{
"name": "gke-cluster",
"location": "us-east1-b",
"cloud": "google",
"secretName": "google-secret",
"properties": {
"gke": {
"master": {
"version": "{{gke-version}}",
},
"nodeVersion": "{{gke-version}}",
"nodePools": {
"pool1": {
"count": 3,
"autoscaling": true,
"instanceType": "n1-standard-2",
"preemptible": false,
"minCount": 3,
"maxCount": 4
}
},
"projectId": "{{google-project-id}}"
}
}
}
EOF
- placeholders need to be replaced with values from your credentials.json file
- supported versions can be retrieved from the Banzai Cloud Cloudinfo service:
curl https://banzaicloud.com/cloudinfo/api/v1/providers/google/services/gke/regions/us-west2/versions
- all nodes forming the cluster will be of the same instance type (n1-standard-2)
- as autoscaling is turned on, it might happen that on higher loads there will be 4 nodes in the cluster
Create a multi node GKE cluster — multiple instance types 🔗︎
The following example creates a multinode GKE cluster where the cluster contains multiple instance types (the nodePools
property has multiple elements)
banzai cluster create <<EOF
{
"name": "gke-cluster",
"location": "us-east1-b",
"cloud": "google",
"secretName": "google-secret",
"properties": {
"gke": {
"master": {
"version": "{{gke-version}}",
},
"nodeVersion": "{{gke-version}}",
"nodePools": {
"pool1": {
"count": 3,
"autoscaling": true,
"instanceType": "n1-standard-2",
"preemptible": false,
"minCount": 3,
"maxCount": 4
},
"pool2": {
"count": 1,
"autoscaling": true,
"instanceType": "m1-megamem-96",
"preemptible": true,
"minCount": 1,
"maxCount": 2
}
},
"projectId": "{{google-project-id}}"
}
}
}
EOF
Notable differences compared to the first example:
- the cluster will be formed of nodes of different instance types (there are 2 node pools defined)
- the number of instances is controlled on a per node pool basis
- the second node pool will be filled with preemptible instances
Check the status of the cluster 🔗︎
To check the status of the cluster, run the following command:
banzai cluster get "<cluster-name>"
Once the cluster is ready, you can try to run some simple commands.
banzai cluster shell
executes a shell within the context of the selected cluster.
If you type a command in the shell opened, or pass arguments to it, it will be executed in a prepared environment.
For example, you can list the nodes of the cluster using the original kubectl
command by running:
banzai cluster shell --cluster-name "<cluster-name>" -- kubectl get nodes
Further steps 🔗︎
If you are happy with the results, go on with the Deploying workload guide to learn about the basic features of a cluster.