Last active
September 21, 2024 19:56
-
-
Save apeckham/84b8fb8c1163dbe2021a4f6adffc1311 to your computer and use it in GitHub Desktop.
gitlab runner on GKE autopilot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Created new Autopilot cluster | |
# https://docs.gitlab.com/runner/install/kubernetes.html | |
# Create a runner at https://gitlab.com/groups/GROUP/-/runners | |
wget https://github.com/derailed/k9s/releases/download/v0.28.2/k9s_Linux_amd64.tar.gz | |
tar xvfz k9s*gz | |
gcloud container clusters get-credentials CLUSTER --region REGION --project PROJECT | |
helm repo add gitlab https://charts.gitlab.io | |
helm repo update gitlab | |
helm search repo -l gitlab/gitlab-runner | |
helm show values gitlab/gitlab-runner >values.yaml | |
vim values.yaml | |
# set runnerToken, gitlabUrl=https://gitlab.com, rbac.create=true, check_interval=5,... | |
helm install gitlab-runner -f values.yaml gitlab/gitlab-runner | |
vim values.yaml | |
helm upgrade gitlab-runner -f values.yaml gitlab/gitlab-runner | |
kubectl get po | |
kubectl get events --watch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/gitlab-runner/values.yaml b/values.yaml | |
index d426253..6237425 100644 | |
--- a/gitlab-runner/values.yaml | |
+++ b/values.yaml | |
@@ -49,7 +49,7 @@ imagePullPolicy: IfNotPresent | |
## The GitLab Server URL (with protocol) that want to register the runner against | |
## ref: https://docs.gitlab.com/runner/commands/index.html#gitlab-runner-register | |
## | |
-# gitlabUrl: http://gitlab.your-domain.com/ | |
+gitlabUrl: https://gitlab.com | |
## DEPRECATED: The Registration Token for adding new Runners to the GitLab Server. | |
## | |
@@ -61,7 +61,7 @@ imagePullPolicy: IfNotPresent | |
## be retrieved from your GitLab Instance. It is token of already registered runner. | |
## ref: (we don't yet have docs for that, but we want to use existing token) | |
## | |
-# runnerToken: "" | |
+runnerToken: "XXXXX" | |
# | |
## Unregister all runners before termination | |
@@ -91,7 +91,7 @@ terminationGracePeriodSeconds: 3600 | |
## Configure the maximum number of concurrent jobs | |
## ref: https://docs.gitlab.com/runner/configuration/advanced-configuration.html#the-global-section | |
## | |
-concurrent: 10 | |
+concurrent: 30 | |
## Number of seconds until the forceful shutdown operation times out and exits the process. | |
## ref: https://docs.gitlab.com/runner/configuration/advanced-configuration.html#the-global-section | |
@@ -101,7 +101,7 @@ shutdown_timeout: 0 | |
## Defines in seconds how often to check GitLab for a new builds | |
## ref: https://docs.gitlab.com/runner/configuration/advanced-configuration.html#the-global-section | |
## | |
-checkInterval: 30 | |
+checkInterval: 3 | |
## Configure GitLab Runner's logging level. Available values are: debug, info, warn, error, fatal, panic | |
## ref: https://docs.gitlab.com/runner/configuration/advanced-configuration.html#the-global-section | |
@@ -144,7 +144,7 @@ sessionServer: | |
## For RBAC support: | |
rbac: | |
- create: false | |
+ create: true | |
## Define list of rules to be added to the rbac role permissions. | |
## Each rule supports the keys: | |
@@ -330,6 +330,12 @@ runners: | |
[runners.kubernetes] | |
namespace = "{{.Release.Namespace}}" | |
image = "alpine" | |
+ memory_limit = "8Gi" | |
+ cpu_limit = "6" | |
+ pull_policy = "if-not-present" | |
+ ephemeral_storage_limit = "10Gi" | |
+ [runners.kubernetes.node_selector] | |
+ "cloud.google.com/gke-spot" = "true" | |
## Absolute path for an existing runner configuration file | |
## Can be used alongside "volumes" and "volumeMounts" to use an external config file | |
priorityClassName: "gitlab-runner-priority" | |
service_ephemeral_storage_limit | |
service_memory_limit | |
service_cpu_limit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: scheduling.k8s.io/v1 | |
kind: PriorityClass | |
metadata: | |
name: gitlab-runner-priority | |
value: 1000000 | |
globalDefault: false | |
description: "This priority class should be used for the gitlab runner pod only." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment