DEV Community 👩‍💻👨‍💻

Cover image for How to deploy and maintain Kubernetes cluster with Kubemarine, open source tool
Julia Murashova for Netcracker

Posted on • Updated on

How to deploy and maintain Kubernetes cluster with Kubemarine, open source tool

Some background

In Netcracker, we build and deliver enterprise-grade cloud ecosystems based on Kubernetes to our customers. Such solutions consist of both enterprise Kubernetes, which we prepare and maintain using the appropriate tools and many managed infrastructure cloud services, such as PostgreSQL, Cloud Streaming, Cloud Queues, etc. Kubemarine is one of these tools we created to solve engineering challenges, and now we are making it Opensource.

What is Kubemarine?

Kubemarine is an open source, lightweight and powerful management tool built for end-to-end Kubernetes cluster deployment and maintenance.

It's applicable for many purposes like simple and quick onboarding Kubernetes on local and production environments in different HA schemes depending on your aims, budget and capabilities. Together with simplicity Kubemarine can be very flexible and customizable tool covering specific configurability cases on both deployment and maintenance stages. This library provides powerful CLI commands, as well as can be customized via Python extension API.

The tool should be helpful for Cloud and DevOps engineers.

Highlights and what can be done with Kubemarine

  • Easy to use
  • Many procedures supported: install, add_node, remove_node, upgrade, backup, restore, check_iaas, check_paas, manage_psp.
  • Single cluster inventory for all operations, highly customizable
  • Default values of all parameters in configurations with a minimum of required parameters
  • Control planes balancing with external balancers and VRRP
  • Ability to resume or skip specific task without re-running entire pipeline
  • Pre-built plugins out of the box and custom plugins support
  • Support for executing in closed environments with private registries
  • Extended logging, configs dumping
  • Build supported as a package, container and binary
  • Package extension with open extension API
  • Support different deployment schemes (all-in-one, mini-HA, HA, etc.)

Kubemarine CLI Installation

1 Install latest python3
2 Upgrade pip:

python3 -m pip install --upgrade pip
Enter fullscreen mode Exit fullscreen mode

3 Ensure your environment meets Deployment Node Prerequisites
4 Download the latest release or clone the repo:

git clone https://github.com/netcracker/kubemarine.git
Enter fullscreen mode Exit fullscreen mode

5 Unpack project from archive if required

tar xzvf X.X.X.tar.gz
Enter fullscreen mode Exit fullscreen mode

6 Navigate to project directory:

cd kubemarine
Enter fullscreen mode Exit fullscreen mode

7 Install Python dependencies

python3 -m pip install -r requirements.txt
Enter fullscreen mode Exit fullscreen mode

8 Optionally add Kubemarine to PATH. You can do this by adding symlink to /usr/local/bin:

sudo ln -s $(pwd)/bin/kubemarine /usr/local/bin/kubemarine
sudo chmod +x /usr/local/bin/kubemarine
Enter fullscreen mode Exit fullscreen mode

Alternatively, if you do not have root privileges, you can update your PATH in *rc file. Example:

echo "export PATH=\$PATH:$(pwd)/bin" >> ~/.bashrc
source ~/.bashrc
Enter fullscreen mode Exit fullscreen mode

If you don't want to add something to path, you can execute the Kubemarine directly from bin location:

cd bin
Enter fullscreen mode Exit fullscreen mode

Now you can proceed to run Kubemarine! Try the following:

kubemarine [help](kubemarine help)
Enter fullscreen mode Exit fullscreen mode

Note: building from Dockerfile is also available.
Note: Kubemarine debugging available via

> kubemarine/__main__.py.

Running Cluster Installation

Proceed the following steps to install Kubernetes cluster using Kubemarine:

  1. Prepare your VMs or bare-metal machines according to Recommended Hardware Requirements and selected Deployment Scheme. Make sure the nodes meet Cluster Nodes Prerequisites
  2. Create inventory file cluster.yaml and describe your env and everything should be configured. See inventory configs available and examples. No need to fill in all the parameters that are available, it is enough to specify the minimal identification data about the nodes where you want to install the cluster, for example:
node_defaults:
  keyfile: "/home/username/.ssh/id_rsa"
  username: "centos"

vrrp_ips:
  - 192.168.0.250

nodes:
  - name: "k8s-control-plane-1"
    address: "10.101.0.1"
    internal_address: "192.168.0.1"
    roles: ["balancer", "control-plane", "worker"]
  - name: "k8s-control-plane-2"
    address: "10.101.0.2"
    internal_address: "192.168.0.2"
    roles: ["balancer", "control-plane", "worker"]
  - name: "k8s-control-plane-3"
    address: "10.101.0.3"
    internal_address: "192.168.0.3"
    roles: ["balancer", "control-plane", "worker"]

cluster_name: "k8s.example.com"
Enter fullscreen mode Exit fullscreen mode
  1. Move cluster.yaml to the directory, where Kubemarine installed
  2. Start installation
kubemarine install
Enter fullscreen mode Exit fullscreen mode

Image description

In the Kubemarine repository, you'll find more guides for:

  • Maintenance
  • Troubleshooting
  • Kubecheck
  • Logging

Community and contributors

Thanks for the Illustrations Wooly collection on icons8.com

Top comments (0)

🌚 Friends don't let friends browse without dark mode.

Sorry, it's true.