Automation scripts for Kubernetes cluster deployment on Virtual Machines on Nutanix cluster. Under the hood it's using Nutanix API for vm creation and Kubespray for Kubernetes deployment.
Installer consists of modules preparing Virtual Machines for Kubernetes cluster and generating ansible inventory for Kubespray.
- Nutanix cluster
- VM
- OS image (installer supports creating Centos 7 VMs, image will be downloaded if not provided)
- git package
- virtualenv and python packages
- openssl / libssl packages
- Install packages required on deplyoment node.
- Clone repository.
- Edit Configuration Files (otherwise defaults will be used).
- Upload public ssh keys for user who will need access to created vms to ssh_keys. Keys should be using format username.pub so installator will create user with username and upload key for him. You can use other directory and specify it using installator options.
- Run installation script.
yum group install "Development Tools"
yum install -y python-virtualenv git-all libffi-devel.x86_64 openssl-devel.x86_64
git clone https://github.com/nutanix/k8s.git
Configuration File location :
- Nutanix cluster config.
k8s/configs/nutanix_cluster.yml
Default(example) configuration :
# Cluster settings
clusters:
prod-cluster:
address: 1.4.6.1
port: 9440
sample:
address: 0.0.0.0
port: 9440
Variables :
prod-cluster
: human-readable name of your Nutanix cluster
address
: Prism IP
port
: Prism port
- Kubernetes Cluster and VM configuration file.
k8s/configs/k8s_cluster.yml
Default(example) configuration :
# Kubernetes cluster and vms settings
common:
os_image_name: centos7_cloud
network_name: external
storage_container_name: images
vm_disk_size: 10
master:
number_of_nodes: 3 # 1 or 3 or 5
number_of_vcpu: 2
ram_size: 4
worker:
number_of_nodes: 3
number_of_vcpu: 2
ram_size: 4
Variables :
os_image_name
: currently we are supporting only Centos 7.
If you already uploaded Centos 7 cloud image to your Nutanix cluster pass its name here,
otherwise installer will upload image to Nutanix cluster using default name
storage_container_name
: your storage container name for images
network_name
: Nutanix cluster network name in which you want to have Kubernetes cluster vms
vm_disk_size
: disk size of created vms (in GB)
number_of_nodes
: number of vms for Kubernetes master
or worker
plane
number_of_vcpu
: number of cores per vm for Kubernetes master
or worker
plane
ram_size
: size of RAM per vm for Kubernetes master
or worker
plane
With all requirements met, deployment is executed by following commands :
- Switch to script location.
- Run start script. Arguments used are the names used earlier in configuration files.
cd k8s
install.sh --nutanix-cluster nutanix_cluster_name --kubernetes-cluster kubernetes_cluster_name --user remote_user --base-vm-name k8s_base_vm --ssh-dir ssh_keys/
--nutanix-cluster
: human-readable name of your Nutanix cluster cluster from k8s/configs/nutanix_cluster.yml
--kubernetes-cluster
: domain name for Kubernetes internal use.
installer requires that it should be unique for different Kubernetes clusters created by it.
--user
: username of user that will be deploying kubernetes (his kpublic key need to be in ssh-dir)
-base-vm-name
: name of base vm which will be used for os pre-configuration. It needs to differ from kubernetes-cluster name.
--ssh-dir
: directory where public keys will be placed. Default ssh_keys/
After successful deployment in .kubespray/artifacts/
you should find kubectl
and admin.conf
files.
To e.g get nodes status run:
./kubectl --kubeconfig admin.conf get nodes
There is also dashboard deployed - you can access it via browser:
https://master_node_ip:6443/ui
. By default user is kube
and password changeme
.
Due to recent changes you will need to add administrator certificates from admin.conf
to your browser.
Detailed logs of creating vms by default can be found in /tmp/k8s_installer.log
This project is licensed under Apache v.2 License - see the LICENSE.md file for details.
- Add support for Nutanix Persistent Volumes