Kubermatic KubeOne - Quick HA Production Grade kubernetes cluster ¶
KubeOne is profession production grade kubernetes distribution by Kubermatic. It helps creation of HA cluster across many different cloud providers like AWS, Azure, GCP, hetzner, as well as on-prem like OpenStack and vSphere. You can get a cluster setup done in about 10 minutes. It also provides declarative configuration using yaml based configuration. It uses Cluster-API and MachineController APIs to easily add, remove, upgrade, scale the nodes.
Installation ¶
- Get Kubeone by running
curl -sfL get.kubeone.io | sh
in terminal. This will install kubeone binary in your/usr/local/bin
folder and unpack example terraform config in current directory. The unpacked terraform example are present inkubeone
directory of this github repository. - Enable the shell completion via
source <(kubeone completion zsh)
/source <(kubeone completion bash)
depending upon your shell. - navigate to appropriate example directory for your trial. e.g.
examples/terraform/aws
for setting up Kubeone on AWS. - Setup AWS profile via
export AWS_PROFLE=xxx
/ credentials. - If you are using GCP you can use
export GOOGLE_CREDENTIALS=xxxx.json
to set credentials json path. - Create minimal
terraform.tfvars
to customize terraform variables. You can customize every variable in terraform.
OR# tfvars for AWS
cluster_name = "vj1"
ssh_public_key_file = "~/.ssh/id_rsa.pub"
# optional
#aws_region="ap-south-1"# tfvars for GCP
cluster_name = "vj1"
ssh_public_key_file = "~/.ssh/id_rsa.pub"
project = "personal" #GCP project name
# optional
#aws_region="ap-south-1" - You will need to have ssh key specified above added in ssh-agent. (Option exists to provide it directly as well without using sss-agent). Use below script to add keys to ssh-agent.
eval `ssh-agent`
ssh-add ~/.ssh/id_rsa # or any other PEM private key! - Once this done, create infrastructure using terraform
terraform init
terraform plan
# for everything else except GCP
terraform apply
# If using GCP... use below apply commands after downlading the service account json
# export GOOGLE_CREDENTIALS=$(cat ./XXXX.json)
#terraform apply -var=control_plane_target_pool_members_count=1
# Copy the output in json format so that kubeone can use it to install infra on it
terraform output -json > tf.json - Now create the minimal kubeone config yaml file.
- Use kubeone to create k8s cluster
kubeone apply --manifest kubeone.yaml -t tf.json --verbose
- Watch cluster getting setup
# Replace <CLUSTER_NAME> with name of the cluster you provided in kubeone config yaml.
export KUBECONFIG=./<CLUSTER_NAME>-kubeconfig
kubectl get md,ms,ma,node -n kube-system
kubectl get node -w - Post installation, a kubeconfig file prefix as your project name will be created in the current working directory. You can use that kubeconfig to connect to new kubeone kubernetes cluster.
- You can also have additional addons
- To destroy
kubeone reset --manifest kubeone.yaml -t tf.json --verbose
terraform destroy
Categories
- kubernetes
- distribution
- production-grade