Created
June 12, 2020 03:28
-
-
Save JasonGhent/964fb82d8924c8852b3ae087ce5d4103 to your computer and use it in GitHub Desktop.
self-hosted gitlab baremetal k8s cluster with metallb [persistence mostly disabled; see L54.]
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
# File: ./Makefile.gitlab | |
# Usage: make -f Makefile.gitlab | |
# NOTE: Assumes Debian 9 OS | |
MAKEFLAGS += --silent | |
define K8S_METALLB_CMD | |
cat <<EOF | kubectl apply -f - | |
apiVersion: v1 | |
kind: ConfigMap | |
metadata: | |
namespace: metallb-system | |
name: config | |
data: | |
config: | | |
address-pools: | |
- name: defaul-ip-pool | |
protocol: layer2 | |
addresses: | |
- 192.1168.1.240-192.168.1.250 | |
EOF | |
endef | |
export K8S_METALLB_CMD | |
all: | |
apt update | |
apt install apt-transport-https ca-certificates curl gnupg2 software-properties-common vim make | |
curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add - | |
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $$(lsb_release -cs) stable" | |
\ | |
apt update | |
apt-cache policy docker-ce | |
apt install -y docker-ce | |
\ | |
docker run -d --restart=unless-stopped -p 80:80 -p 443:443 rancher/rancher | |
echo "Wait until <hostname> is available (https://hostname.domain)" | |
echo "FROM THERE..." | |
echo '' | |
echo "[Add cluster] run the resulting docker command with etcd, worker, and control plane" | |
echo "[..] wait for cluster node to appear, then.." | |
echo "[cluster > storage] add persistent host volumes (50G [min for minio] x 5)" # TODO: rook.io? | |
echo '' | |
echo "# From cluster UI" # INSTALLS METALLB | |
echo "kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.9.3/manifests/namespace.yaml" | |
echo "kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.9.3/manifests/metallb.yaml" | |
echo "kubectl create secret generic -n metallb-system memberlist --from-literal=secretkey=\"$(openssl rand -base64 128)\" # On first install only!" | |
echo "$$K8S_METALLB_CMD" | |
echo '' | |
echo "# From default namespace UI" | |
echo "[catalog] https://charts.gitlab.io" | |
echo '' | |
echo "[apps > launch] gitlab" | |
echo "# WITH ANSWERS:" | |
echo '"certmanager.install": "false"' | |
echo '"gitlab-runner.install": "false"' | |
echo '"gitlab.gitaly.persistence.enabled": "false"' | |
echo '"global.hosts.domain": "hostname.domain"' | |
echo '"global.ingress.configureCertmanager": "false"' | |
echo '"minio.persistence.enabled": "false"' | |
echo '"postgresql.persistence.enabled": "false"' | |
echo '"prometheus.install": "false"' | |
echo '"redis.persistence.enabled": "false"' | |
echo '' | |
echo '# REMEMBER! Add DNS entries for the gitlab host to /etc/hosts!' | |
echo 'something like.. "192.168.1.[240-250] hostname.domain" | |
# refs: | |
# https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-debian-9 | |
# https://rancher.com/quick-start/ | |
# https://gitlab.com/gitlab-org/gitlab-foss/-/blob/master/doc/topics/autodevops/index.md | |
# https://rancher.com/blog/2019/connecting-gitlab-autodevops-authorized-cluster-endpoints | |
# https://docs.gitlab.com/charts/installation/tls.html#internal-cert-manager-and-issuer | |
# https://docs.gitlab.com/charts/installation/command-line-options.html | |
# https://forum.gitlab.com/t/using-metallb-to-implement-a-network-load-balancer-on-self-hosted-or-metal-kubernetes-installation/22100 | |
.PHONY: all |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment