###This repo is out of date. Please check out https://github.com/joyent/k8s-triton-supervisor.###
In this guide, we will start a simple 2 worker node Kubernetes install that runs on Joyent Cloud.
In order to start running Triton K8s Supervisor, you must create a Triton account and install the Triton CLI, Terraform, Ansible, and the Kubernetes CLI.
Triton is our container-native and open source cloud, which we will use to provide the infrastructure required for your Kubernetes cluster.
Terraform enables you to safely and predictably create, change, and improve production infrastructure. It is an open source tool that codifies APIs into declarative configuration files that can be shared amongst team members, treated as code, edited, reviewed, and versioned. We use Terraform to provision virtual machines, set up root access, and install python
.
Ansible is an IT automation tool that enables app deployment, configuration management and orchestration. We are using Ansible to install pre-reqs (including supported version of docker-engine), create Kubernetes environment and set up Kubernetes cluster.
In order to install Triton, first you must have a Triton account. As a new user you will recieve a $250 credit to enable you to give Triton and Kubernetes a test run, but it's important to add your billing information and add an ssh key to your account. If you need instructions for how to generate and SSH key, read our documentation.
- Install Node.js and run
npm install -g triton
to install Triton CLI. triton
uses profiles to store access information. You'll need to set up profiles for relevant data centers.triton profile create
will give a step-by-step walkthrough of how to create a profile.- Choose a profile to use for your Kubernetes Cluster.
- Get into the Triton environment with
eval $(triton env <profile name>)
. - Run
triton info
to test your configuration.
Download Terraform and unzip the package. Terraform runs as a single binary named terraform. The final step is to make sure that the terraform binary is available on the PATH. See this page for instructions on setting the PATH on Linux and Mac.
Test your installation by running terraform
. You should see an output similar to:
$ terraform
Usage: terraform [--version] [--help] <command> [args]
The available commands for execution are listed below.
The most common, useful commands are shown first, followed by
less common or more advanced commands. If you're just getting
started with Terraform, stick with the common commands. For the
other commands, please read the help and docs before usage.
Common commands:
apply Builds or changes infrastructure
console Interactive console for Terraform interpolations
# ...
There are many ways to install Ansible, but the simplest would be to use Python package manager (pip
). If you don’t already have pip
installed, install it:
sudo easy_install pip
Ansible by default manages machines over SSH and requires Python 2.6 or 2.7 to be installed on all the hosts.
Install Ansible:
sudo pip install ansible
Once done, you can run ansible
to test your installation. You should see a list of usage commands that looks like the following:
$ ansible
Usage: ansible <host-pattern> [options]
Options:
-a MODULE_ARGS, --args=MODULE_ARGS
module arguments
--ask-vault-pass ask for vault password
-B SECONDS, --background=SECONDS
run asynchronously, failing after X seconds
(default=N/A)
-C, --check don't make any changes; instead, try to predict some
of the changes that may occur
-D, --diff when changing (small) files and templates, show the
differences in those files; works great with --check
[...]
There are different ways to install kubectl
, but the simplest way is via curl
:
# OS X
curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/darwin/amd64/kubectl
# Linux
curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
# Windows
curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/windows/amd64/kubectl.exe
Download the k8sontriton package and run setup.sh
:
$ git clone https://github.com/fayazg/tritonK8ssupervisor.git
Cloning into 'tritonK8ssupervisor'...
$ cd tritonK8ssupervisor
$ ./setup.sh
Follow the on screen instructions answering questions about the cluster. You can use the default by pressing “Enter”/”Return” key.
Name your Kubernetes environment: (k8s dev)
Describe this Kubernetes environment: (k8s dev)
Would you like HA for Kubernetes Cluster Manager (+3 VMs) (yes | no)?
Run Kubernetes Management Services on dedicated nodes (+3 VMs for etcd, +3 VMs for K8s services - apiserver/scheduler/controllermanager...) (yes | no)?
Hostname of the master: (kubemaster)
Enter a string to use for appending to hostnames of all the nodes: (kubenode)
How many nodes should this Kubernetes cluster have: (1) 2
What networks should the master be a part of, provide comma separated values: (31428241-4878-47d6-9fba-9a8436b596a4)
What networks should the nodes be a part of, provide comma separated values: (31428241-4878-47d6-9fba-9a8436b596a4)
What KVM package should the master and nodes run on: (14b6fade-d0f8-11e5-85c5-4ff7918ab5c1)
After verification of the entries, setup will provide a Kubernetes environment on triton that will be set up as below (if HA isn't set up):
For a more detailed guide and how the automation works, click here.