How to setup K8s on premise

March 23, 2023

This doc covers steps to bring up Kubernetes cluster in on premise environment using ansible. Also deploy custom services(own services)

Pre-requisites

Note: SSH keys provide better security over shh_passwords.

Approach (at high level)

Sample:

master1 <ip-1/master-node01> ansible_password=<???>

worker1 <ip-2/worker-node01> ansible_password=<???>
worker2 <ip-3/worker-node03> ansible_password=<???>

Now that we have the cluster up & running.. lets setup our custom services.


We can deploy them in one of following ways…

  1. Deploy kubernetes spec through ansible playbook (this would copy the files to master node, then kubectl applies them)
  2. If we want deploy our services as a helm chart, we can deploy it via ansible playbook. Pls, note that we need to have helm available in master node to run helm install <our-chart>
  3. Deploy an agent pod with (mTLS cert), which can pull latest kubernetes spec files from remote server(ours) and deploys them in the cluster

We can also copy kube.config file locally(from master node), then run kubectl or helm cmd direclty to deploy.

Search for pre-existing roles(from galaxy.ansible.com) if any available to deploy kubernetes to on-premise

Note: Based pros & cons we can conclude on one approach which suits best.

Other Considerations