Setup - Linode
Setting up a Kubernetes Cluster with Linode (linode)

Deploy a Kubernetes cluster in Linode using LKE service.

Requirements

    1.
    a Linode account
    2.
    linode-cli and linode credentials configured
    3.
    kubectl
LINUX/MAC is the preferred method of setup.
Windows should choose either:
    1.
    Deploy a THORNode from a Linux VPS.
    2.
    Use Windows Subsystem for Linux - https://docs.microsoft.com/en-us/windows/wsl/about****

linode-cli

To install the linode-cli (Linode CLI), follow these instructions.
You need to have pip (python) on your system.
1
pip install linode-cli --upgrade
Copied!
Create a Linode API token for your account with read and write access from your profile page. The token string is only displayed once, so save it in a safe place.
Use the API token to grant linode-cli access to your Linode account. Pass in the token string when prompted by linode-cli.
1
linode-cli
Copied!

kubectl

To install the kubectl (Kubernetes CLI), follow these instructions or choose a package manager based on your operating system.
MacOS:
Use the package manager homebrew to install kubectl.
1
brew install kubernetes-cli
Copied!
Windows:
Use the package manager Chocolatey to install kubectl.
1
choco install kubernetes-cli
Copied!

wget

To install the wget, follow these instructions or choose a package manager based on your operating system.
MacOS:
Use the package manager homebrew to install wget.
1
brew install wget
Copied!
Windows:
Use the package manager Chocolatey to install wget.
1
choco install wget
Copied!

Deploy Kubernetes Cluster

Use the commands below to deploy a Kubernetes cluster.
You can run the make command that automates those command for you like this:
1
make linode
Copied!
Or manually run each commands:
1
cd linode/
2
terraform init
3
terraform plan # to see the plan
4
terraform apply
Copied!

Configure kubectl

Now that you've provisioned your Kubernetes cluster, you need to configure kubectl.
To configure authentication from the command line, use the following command, substituting the ID of your cluster.
1
# Store it - method #1
2
jq -r ".resources[].instances[].attributes.kubeconfig" linode/terraform.tfstate | base64 -D > ~/.kube/config-linode
3
4
# Store it - method #2
5
linode-cli lke kubeconfig-view <use_your_cluster_id> > ~/.kube/config-linode
6
7
# Merge it and set current context
8
KUBECONFIG=~/.kube/config:~/.kube/config-linode kubectl config view --flatten > ~/.kube/tmpcfg && mv -f ~/.kube/tmpcfg ~/.kube/config && kubectl config use-context $(kubectl config current-context --kubeconfig=~/.kube/config-linode)
9
10
# Or just view it - method #1
11
jq -r ".resources[].instances[].attributes.kubeconfig" linode/terraform.tfstate | base64 -D
12
# Or just view it - method #2
13
linode-cli lke kubeconfig-view <use_your_cluster_id>
Copied!
Note: If the above linode-cli command is broken you can download the file from the web dashboar for the respective cluster.
This replaces the existing configuration at ~/.kube/config.
Once done, you can check your cluster is responding correctly by running the command:
1
kubectl version
2
kubectl get nodes
Copied!

Clean up your workspace

To destroy and remove previously created resources, you can run the command below.
1
make destroy-linode
Copied!
Or run the commands manually:
1
cd linode/
2
terraform destroy
Copied!
Last modified 5d ago