Skip to content

Latest commit

 

History

History
152 lines (94 loc) · 3.91 KB

kubernetes.md

File metadata and controls

152 lines (94 loc) · 3.91 KB

Kubernetes Host Environment Setup

If you are working with multiple cluster hosting clients, you may need to switch cluster context for your deployment. See the below commands:

kubectl config get-contexts
kubectl config use-context <context-name>

Minikube (local Kubernetes)

For the Kubernetes deployment to work as expected, we need to ensure we have minikube installed on our local machine running the deployment. Follow these steps to install minikube

Once installed, we can start the minikube service be executing the below command:

minikube start --cpus 4 --memory 8192 --disk-size 8g

This also updates the VM settings to make use of 4 CPU's and 8GB of RAM, instead of the default 2 CPU's and 4GB of RAM. Also the disk space is reduced from the default 20GB to 8GB to save space.

Amazon Web Services

Useful links:

Some prerequisites are required before we can continue to deploy our Kubernetes infrastructure to an AWS cluster.

  • You have created all the various users and permissions as required.
  • You have given the users the relevant access to the AWS services
  • You have generated an access token for your AWS user
  • You have installed all the relevant CLI tools

Install AWS Cli

curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"

unzip awscliv2.zip

sudo ./aws/install

Configure with your AWS token details

aws configure

Install EksCtl

curl --silent --location "https://github.com/weaveworks/eksctl/releases/download/latest_release/eksctl_$(uname -s)_amd64.tar.gz" | tar xz -C /tmp

sudo mv /tmp/eksctl /usr/local/bin

eksctl version

Install Kubectl

curl -LO https://storage.googleapis.com/kubernetes-release/release/`curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt` /bin/linux/amd64/kubectl

chmod +x ./kubectl

sudo mv ./kubectl /usr/local/bin/kubectl

kubectl version --client

Create the cluster

Before we can deploy our Kubernetes infrastructure we need to make sure we have created a cluster for us to deploy to. Execute the below command to create the cluster within AWS EKS

yarn eks:cluster:create

Once this completes you may execute a Kubernetes deployment, kubectl should already be configured to point to the newly created cluster. E.g.

yarn docker:instant init -t k8s

Access an existing cluster

  1. See the available clusters

    eksctl get clusters
  2. Create config file locally to reference existing cluster

    eksctl utils write-kubeconfig --cluster <cluster-name>
  3. Check current cluster context

    kubectl config get-contexts

Kill cluster

yarn eks:cluster:destroy

Google Cloud

Useful Links:

Azure

Useful Links:

Install Azure Cli

curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash

az login

Digital Ocean

Useful Links:

Install Digital Ocean Ctl

curl -OL https://github.com/digitalocean/doctl/releases/download/v<version>/doctl-<version>-linux-amd64.tar.gz

sudo mv ./doctl /usr/local/bin

See here for latest version