Gitpod Installation - k3s
Document Last Modified: 2022-06-02 20:40:21
This document is outdated. I recommended using this guide for the time being.
Setting Up PostgreSQL
- Create a PostgreSQL user for k3s:
CREATE USER k3s WITH ENCRYPTED PASSWORD '$PASSWORD'; - Create a database for k3s to use:
CREATE DATABASE k3s; - Grant privileges to the k3s user:
GRANT ALL PRIVILEGES ON DATABASE k3s TO k3s;
Master Node
- Once Ubuntu 20.04.x has been installed, login via SSH and run
apt updateand thenapt upgrade. - Next edit the
/etc/fstabfile and comment out the swap line. Reboot the system. - Confirm that swap has been disabled -
free -mh. - Set the timezone using -
sudo dpkg-reconfigure tzdata- set it to America/Chicago (or whatever your local timezone is). - Install k3s in master mode (run this as the root user):
$ curl -sfL https://get.k3s.io | sh -s - --datastore-endpoint 'postgres://k3s:$POSTGRES_PASSWORD@$HOSTNAME:5432/k3s?sslmode=disable' --write-kubeconfig-mode 644 --disable traefik --disable servicelb
Worker Node
- Once Ubuntu 20.04.x has been installed, login via SSH and run
apt updateand thenapt upgrade. - Next edit the
/etc/fstabfile and comment out the swap line. Reboot the system. - Confirm that swap has been disabled -
free -mh. - Set the timezone using -
sudo dpkg-reconfigure tzdata- set it to America/Chicago (or whatever your local timezone is). - Install k3s in agent mode (run this as the root user):
$ export K3S_URL=https://$MASTER_NODE_HOSTNAME:6443 $ export K3S_TOKEN=$TOKEN $ curl -fsL https://get.k3s.io | K3S_URL=$K3S_URL K3S_TOKEN=$K3S_TOKEN sh -s agent --disable traefik --disable servicelb
Setting Up MySQL
- Run these queries in MySQL server to get the user and databases setup properly:
CREATE USER IF NOT EXISTS "gitpod"@"%" IDENTIFIED BY 'PASSWORD_HERE'; GRANT ALL ON gitpod%.* TO "gitpod"@"%";
CREATE DATABASE IF NOT EXISTS gitpod-sessions CHARSET utf8mb4; USE gitpod-sessions;
CREATE TABLE IF NOT EXISTS sessions ( session_id varchar(128) COLLATE utf8mb4_bin NOT NULL, expires int(11) unsigned NOT NULL, data text COLLATE utf8mb4_bin, _lastModified timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), PRIMARY KEY (session_id) );
## Assigning Workloads to Nodes (optional)
Run these command to assign workloads to our nodes. Ideally we just have one "meta" node and the rest are workspace nodes.
```shell-session
$ kubectl label worker-node-1 gitpod.io/workload_meta=true
$ kubectl label worker-node-2 gitpod.io/workload_workspace=true
$ kubectl label worker-node-3 gitpod.io/workload_workspace=true
Updating Kubernetes Configurations
- Set your master node to not allow scheduling:
$ kubectl taint node master-node-name k3s-controlplane=true:NoSchedule
Installing Gitpod
Alright, we're finally ready to install Gitpod!
- Clone the Gitpod self-hosted repository:
$ git clone https://octocat.ninja/gitpod-app/self-hosted.git - Go into the self-hosted directory. From here everything should already be configured for our Gitpod instance.
- From Rancher create a Project named 'Gitpod' and a namespace within there called 'gitpod'.
- Run these helm command to install Gitpod:
$ helm repo add charts.gitpod.io https://charts.gitpod.io $ helm dep update $ helm upgrade --install $(for i in $(cat configuration.txt); do echo -e "-f $i"; done) gitpod . --namespace gitpod --timeout 60m --version 0.5.0
Copyright © 2025 jimmyb.ninja, All rights reserved.
Coded with