-
Downlaod and install python 3 on local machine (if not already installed): https://www.python.org/downloads/
-
cd
to project directory and create a virtual enviroment$ python3 -m venv env
-
Activate virtual enviroment
$ source env/bin/activate
-
Install dependencies
$ pip3 install -r requirements.txt
-
Create and add an SSH key to your digital ocean account: https://docs.digitalocean.com/products/droplets/how-to/add-ssh-keys/to-team/
-
Create a digital ocean access token for API requests: https://docs.digitalocean.com/reference/api/create-personal-access-token/
-
Add the token to your environment:
$ export DIGITAL_OCEAN_ACCESS_TOKEN=[your_token]
-
Spin up the cluster
$ bash create.sh
-
Add kube config to local machine Copy and paste the output from script below line "++++++ Copy the below output and paste into kube config on local machine ++++++" into the open text file. Save and close.
$ cd ~/.kube
$ open -a TextEdit config
-
Test local machine has cluster access
$ kubectl get nodes -o wide
-
Create app namespace and set context
$ kubectl create namespace {namespace} (example: elasticsearch-ns)
$ kubectl config set-context kubernetes-admin@kubernetes --namespace={namespace name}
-
Install Traefik
$ helm repo add traefik https://helm.traefik.io/traefik
$ helm repo update
$ helm install traefik traefik/traefik --namespace traefik --create-namespace
-
Access traefik dashboard
$ kubectl get pods -n traefik
$ kubectl port-forward {pod name} 9000:9000 -n traefik
Go to http://127.0.0.1:9000/dashboard/#/ to ensure traefik is up and running.
-
Add all required K8 resorces to cluster using the command
kubectl apply -f {path/to/yaml}
Enjoy :)
benpayflic / kube-cluster-do-creator Goto Github PK
View Code? Open in Web Editor NEWProvision a Kubernetes cluster on Digital ocean