Preparing GKE resources
For a fully functional GitLab instance, you will need a few resources before
deploying the gitlab
chart. The following is how these charts are deployed
and tested within GitLab.
Creating the GKE cluster
To get started easier, a script is provided to automate the cluster creation. Alternatively, a cluster can be created manually as well.
Scripted cluster creation
A bootstrap script has been created to automate much of the setup process for users on GCP/GKE.
The script will:
- Create a new GKE cluster.
- Allow the cluster to modify DNS records.
- Setup
kubectl
, and connect it to the cluster. - Initialize Helm and install Tiller.
Google Cloud SDK is a dependency of this script, so make sure it’s set up correctly in order for the script to work.
The script reads various parameters from environment variables and an argument
up
or down
for bootstrap and clean up respectively.
The table below describes all variables.
Variable | Description | Default value |
---|---|---|
REGION | The region where your cluster lives | us-central1
|
ZONE_EXTENSION | The extension (a , b , c ) of the zone name where your cluster instances live
| b
|
CLUSTER_NAME | The name of the cluster | gitlab-cluster
|
CLUSTER_VERSION | The version of your GKE cluster | GKE default, check the GKE release notes |
MACHINE_TYPE | The cluster instances’ type | n1-standard-4
|
NUM_NODES | The number of nodes required. | 2 |
PROJECT | the id of your GCP project | No defaults, required to be set. |
RBAC_ENABLED | If you know whether your cluster has RBAC enabled set this variable. | true |
PREEMPTIBLE | Cheaper, clusters live at most 24 hrs. No SLA on nodes/disks | false |
USE_STATIC_IP | Create a static IP for GitLab instead of an ephemeral IP with managed DNS | false |
INT_NETWORK | The IP space to use within this cluster | default |
Run the script, by passing in your desired parameters. It can work with the
default parameters except for PROJECT
which is required:
PROJECT=<gcloud project id> ./scripts/gke_bootstrap_script.sh up
The script can also be used to clean up the created GKE resources:
PROJECT=<gcloud project id> ./scripts/gke_bootstrap_script.sh down
With the cluster created, continue to creating the DNS entry.
Manual cluster creation
Two resources need to be created in GCP, a Kubernetes cluster and an external IP.
Creating the Kubernetes cluster
To provision the Kubernetes cluster manually, follow the GKE instructions.
- We recommend a cluster with 8vCPU and 30GB of RAM.
- Make a note of the cluster’s region, it will be needed in the following step.
Creating the external IP
An external IP is required so that your cluster can be reachable. The external IP needs to be regional and in the same region as the cluster itself. A global IP or an IP outside the cluster’s region will not work.
To create a static IP run:
gcloud compute addresses create ${CLUSTER_NAME}-external-ip --region $REGION --project $PROJECT
To get the address of the newly created IP:
gcloud compute addresses describe ${CLUSTER_NAME}-external-ip --region $REGION --project $PROJECT --format='value(address)'
We will use this IP to bind with a DNS name in the next section.
DNS Entry
If you created your cluster manually or used the USE_STATIC_IP
option with the scripted creation,
you’ll need a public domain with an A record wild card DNS entry pointing to the IP we just created.
Follow the Google DNS quickstart guide to create the DNS entry.
Next Steps
Continue with the installation of the chart once you have the cluster up and running, and the static IP and DNS entry ready.
Help and feedback
If there's something you don't like about this feature
To propose functionality that GitLab does not yet offer
To further help GitLab in shaping new features
If you didn't find what you were looking for
If you want help with something very specific to your use case, and can use some community support
POST ON GITLAB FORUM
If you have problems setting up or using this feature (depending on your GitLab subscription)
REQUEST SUPPORT
To view all GitLab tiers and features or to upgrade
If you want to try all features available in GitLab.com
If you want to try all features available in GitLab self-managed
If you spot an error or a need for improvement and would like to fix it yourself in a merge request
EDIT THIS PAGE
If you would like to suggest an improvement to this doc