Charles Showalter 3444a2a12b | ||
---|---|---|
images | ||
LICENSE | ||
README.md |
README.md
Requirements
- Ubuntu 20.04LTS
- Load Balancer
- MySQL or MariaDB
- Bare Metal or VMs
Specs
We will be utilizing 6 Virtual Machines for this build.
Kubernetes Servers: (3 Total)
Specs | Description |
---|---|
CPU | 4 Cores |
RAM | 8GB |
Disk Space | 32GB |
Kubernetes Workers: (3 Total)
Specs | Description |
---|---|
CPU | 4 Cores |
RAM | 8GB |
Disk Space | 32GB |
Additional Disk | 250GB |
Update Ubuntu
Run the following command to make sure your Ubuntu installation is up to date.
sudo apt-get update && apt-get upgrade -y
Kubernetes Installation
Kubernetes is an open-source container orchestration system for automating software deployment, scaling, and management. Google originally designed Kubernetes, but the Cloud Native Computing Foundation now maintains the project.
Install Kubernetes
Repleace the following variables
- {LOADBALANCER} = This is generally the IP address to your load balancer
- {USERNAME} = MySQL or MariaDB Username
- {PASSWORD} = MySQL or MariaDB Password
- {IP} = IP or hostname of your database server
- {PORT} = MySQL and MariaDB use 3306
- {DATABASE} = Database name
This command will spin up a kubernetes server that does not allow deployments. We will utilize worker nodes for that.
curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION=v1.20.15+k3s1 sh -s - server \
--node-taint CriticalAddonsOnly=true:NoExecute \
--tls-san {LOADBALANCER} \
--disable servicelb \
--disable traefik \
--datastore-endpoint='mysql://{USERNAME}:{PASSWORD}@tcp({IP}:{PORT})/{DATABASE}'
Token
This is needed to add additional servers and workers. Replace {TOKEN} in the following commands with the output of the following:
cat /var/lib/rancher/k3s/server/token
Add Additional Servers
Run the following command to add additional servers to your cluster
curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION=v1.20.15+k3s1 sh -s - server \
--node-taint CriticalAddonsOnly=true:NoExecute \
--tls-san {LOADBALANCER} \
--disable servicelb \
--disable traefik \
--token={TOKEN} \
--datastore-endpoint='mysql://{USERNAME}:{PASSWORD}@tcp({IP}:{PORT}/{DATABASE}'
Add Worker Nodes
curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION=v1.20.15+k3s1 K3S_URL=https://{LOADBALANCER}:6443 K3S_TOKEN={TOKEN} sh -s -
Rancher Installation
Rancher, the open-source multi-cluster orchestration platform, lets operations teams deploy, manage and secure enterprise Kubernetes.
Setup kubectl
The Kubernetes command-line tool, kubectl, allows you to run commands against Kubernetes clusters. https://kubernetes.io/
Kubectl is meant to run on your personal machines to manage kubernetes clusters. You can run this using WSL + Ubuntu or use the link above to configure kubectl for your environment.
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
Configure kubectl
Copy the contents of the following command. You will need for kubectl config.
sudo cat /etc/rancher/k3s/k3s.yaml
Make directory to store our kubectl config.
sudo mkdir ~/.kube
Create our config file and past the contents from above.
sudo nano ~./kube/config
To save and exit nano use the following commands
ctrl+o
ctrl+x
Set read only permissions
sudo chmod 400 ~/.kube/config
Install HELM
Helm helps you manage Kubernetes applications — Helm Charts help you define, install, and upgrade even the most complex Kubernetes application https://helm.sh/docs/intro/install/
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
helm repo add rancher-latest https://releases.rancher.com/server-charts/stable
helm repo update
kubectl create namespace cattle-system
Install Cert-Manager
Cloud native certificate management ... cert-manager is a powerful and extensible X.509 certificate controller for Kubernetes and OpenShift workloads https://cert-manager.io/
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.8.2/cert-manager.yaml
Install Rancher
Replease {HOSTNAME} with the URL you intend to use to access launcher. Depending on your setup you may need to add a line to your host file that points this domain to your load balancer.
helm install rancher rancher-latest/rancher \
--namespace cattle-system \
--set hostname={HOSTNAME}
Rollout Status
kubectl -n cattle-system rollout status deploy/rancher
Rancher temporary password
kubectl get secret --namespace cattle-system bootstrap-secret -o go-template='{{.data.bootstrapPassword|base64decode}}{{ "\n" }}'