Create a Kubernetes Cluster with One Command

pip install linode-cli
linode-cli k8s-alpha create mycluster

Kubernetes container infrastructure on Linode:

  • Start by installing Terraform, the Linode CLI, and add an SSH key to your ssh-agent. If any dependencies are not present, you'll receive installation instructions during command execution. Note: Terraform version 0.12.0+ is required.
  • When you deploy a LoadBalancer-type service through Kubernetes a Linode NodeBalancer will be automatically created and managed for the Pods backing that service. (Linode Cloud Controller Manager)
  • When PersistentVolumes are created through Kubernetes, those volumes will be Linode Block Storage volumes. These are also automatically managed with the lifecycle of the PersistentVolume resource. (Linode Container Storage Interface)
  • Nodes in Kubernetes are labeled with the Linode Region and Linode Type, which can also be used by controllers for the purposes of scheduling
  • The Kubernetes metrics-server is installed, allowing you to use
    kubectl top

The following is the help message for the command:

$ linode-cli k8s-alpha create --help

usage: k8s-alpha create [-h] [--node-type TYPE] [--nodes COUNT]
                        --master-type TYPE] [--region REGION]
                        [--ssh-public-key KEYPATH]
                        NAME

positional arguments:
  NAME                  A name for the cluster.

optional arguments:
  -h, --help            show this help message and exit
  --node-type TYPE      The Linode Type ID for cluster Nodes as retrieved with
                        `linode-cli linodes types`. (default "g6-standard-2")
  --nodes COUNT         The number of Linodes to deploy as Nodes in the
                        cluster. (default 3)
  --master-type TYPE    The Linode Type ID for cluster Master Nodes as
                        retrieved with `linode-cli linodes types`. (default
                        "g6-standard-2")
  --region REGION       The Linode Region ID in which to deploy the cluster as
                        retrieved with `linode-cli regions list`.) (default
                        is whatever you set during CLI configuration)
  --ssh-public-key KEYPATH
                        The path to your public key file which will be used to
                        access Nodes during initial provisioning only! The
                        keypair _must_ be added to an ssh-agent (default
                        $HOME/.ssh/id_rsa.pub)

Here's an example usage of the command, creating a cluster with six 2GB Linodes as the Nodes:

linode-cli k8s-alpha create mycluster77 --node-type g6-standard-1 --nodes 6 --master-type g6-standard-4 --region us-east --ssh-public-key $HOME/.ssh/id_rsa.pub

Once you have created a cluster, that cluster's kubeconfig is automatically merged into your default kubeconfig. The kubectl context is also switched so that you can immediately begin interacting with the cluster. For example:

kubectl get pods --all-namespaces
kubectl create -f the-next-big-social-app-manifest.yaml

To delete a cluster simply run:

linode-cli k8s-alpha delete mycluster77