NOT INTENDED FOR PRODUCTION USE. For pet projects or testing only.
k8s bare metal cluster installer
is intended to help with the installation of the sandbox kubernetes cluster on bare metal infrastructure.
- Ubuntu 16.04+ (local and remote)
sudo
access on remote machines
Installer must be executed locally along with the extra details of the remote host being provided.
Note: installer must be executed as root.
sudo ./k8s-cluster-setup.sh \
-n <node-name> \
-h <node-host> \
-m <node-mode:master/worker> \
-l <node-label> \
-u <remote-user> \
-p <remote-user-password> \
-i <install-updates:true/false> \
-o <observability-stack:true/false> \
-s <observability-stack-node-selector> \
-c <cleanup:true/false>
node-name
(mandatory) desired name of the node. Will be used to set a hostname of the remote machine, as well as hostname of the local SSH configuration (for maintenance access).node-host
(mandatory) remote server host where the node must be installed.node-mode:master/worker
(mandatory) k8s node role (either master or worker).node-label
(optional) additional node label.remote-user
(mandatory) user name for remote access with sudo permissions.remote-user-password
(mandatory) user password for remote access with sudo permissions.install-updates:true/false
(optional, default: false) whether to install updates or not.observability-stack:true/false
(optional, default: false) whether to install prometeus, node-exporter and kube-state-metrics.observability-stack-node-selector
(mandatory ifobservability-stack=true
) target node selector for observability stack.cleanup:true/false
(optional, default: false) whether to perform post-install cleanup or not (remove installer files).
Every installer execution creates a working directory named after .installations/<node-name>-<node-host>
where logs and stages progress is saved. Every log file is named after the timestamp of the installation start.
Installation process is divided into stages. It is done to separate unrelated steps as well as to make them retryable. Every stage creates completion marker in the working directory.
This stage validates OS requirements, installs missing software and updates, and sets the hostname of the machine.
This stage installs kubernetes and related software.
This stage creates a separate maintenance user on the remote machine. User name is k8s
. Additionally a pair of public/private keys is generated and configured for remote access (keys are located in ~/.ssh/<node-name>
).
This stage initializes kubernetes master node. Important step here is to save join
command that needs to be executed during workers installation. Additionally observability stack may be installed if required. At the end, kube.config
will be copied to the installation folder.
This stage joins kubernetes worker node to the kubernetes master node. It is more manual step and requires join
command that was generated on the previous stage for mater node.
This stage installs a demo app to the newly created cluster.
This stage grants kubernetes cluster maintenance access to k8s
user. Also, for security reasons, this stage disables ssh login for root.
After installation is complete the node can be accessed via ssh using k8s
user: ssh <node-name>