feat: mainly multi-node support #20
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Introduction
Despite the amount of code changes to accomplish multi-node deployments almost everything here works as before: you can install a single node with
helmvm installand you can stop the controller processes withsystemctl stop <binaryname>.One thing has been changed:
helmvmas to call ithelmbinin one place andhelmvmin another was confusing (we should consider renaming this repository too).One feature has been removed:
runhas been dropped.And many things have been added:
Building
As before you can only build it on a Linux AMD64 but I have left pre-compiled versions available online for sake of making the review here easier. You can fetch the binary by using the following commands:
If you plan to deploy a single node cluster then the Linux AMD64 version is the one you are looking for. Download it on the server you plan to install and follow the same procedure used to install before, you should be good to go. If you want to build you can (in a Linux AMD64) run any of the following commands:
Choose the right architecture for which you want to build.
Installing a Single Node cluster
To install a single node, as before, you need to run (on the node where you want to install it):
Once the cluster is deployed you can then use the
helmvm shellto access and manage its objects.After entering the
helmvm shellyou will have access to the cluster withkubectl(the environment will be configured to reach the cluster). If you prefer to have access outside of thehelmvm shellyou can, you just need to adjust a couple of environment variables.Installing a Multi Node cluster
If you plan to deploy a multi node cluster you can run, in your laptop, the following command:
This command will drive you through the procedure of creating a new cluster configuration file and then apply it. The config file will be created only once and it will be stored in your
~/.helmvm/etcdirectory. Each subsequent call tohelmvm installwill then attempt to reuse it. If you prefer you can manually craft a configuration file, on this case you can pass it through the-cflag as the example below:This will use the provided config to install or upgrade the cluster (depending if you already have or not a cluster configured on the remote nodes).
NOTE: If you configured more than one
controllernode then you will have the chance of providing a Load Balancer URL to make the cluster high available.The same thing that is valid for Single Node Cluster is also valid here: you can use the
helmvm shellto have access to the cluster objects.Upgrading clusters
For upgrades you have two options: you can upgrade the whole cluster or only upgrade the add-ons and embedded Helm Charts. To upgrade the whole cluster you can run:
Or, for Multi Node Deployments:
This will read the current configuration and apply the new HelmVM version on top of the same previously configured nodes (also valid for Single Node Deployments). If you prefer to keep Kubernetes as is and wants to upgrade only the add-ons (Helm Charts embedded into the binary) you can run:
Or, for Multi Node Deployments:
Embedding your own Helm Charts
It is easy to embed your own Helm Chart into the binary and make it to be installed whenever a cluster is created or upgraded. The idea is: you download
helmvmand use it to embed your own Helm Charts and then you can distribute the new binary to your customers. With thehelmvmalready installed you can run:Some of the parameters above are optional but they will make sense when we get to the "Disconnected installs" below. This command will embed the
memcached-6.5.6.tgzHelm Chart intohelmvmand a new binary will be created in the current directory calledmemcached. From this point on you can use thememcachedbinary as if it was ahelmvmbinary (the difference here is that one installsmemcachedthe other not), to install it on a multi-node cluster you can run:The command
systemctl stop memcachedandsystemctl start memcachedwill be available inside the nodes. The same is valid for Single Node Deployments.NOTE: Imagine when you run
helmvm embedit embeds your chart while also addin thereplicatedHelm Chart as a dependency of it. How cool wouldn't it be?Disconnected installs
In order to install in a disconnected environment we need to have all images necessary to get the cluster running, therefore you need to first download all these images. This HelmVM on this PR version allows you do download all the necessary images by running:
This will create a directory called
bundleinside the current directory, you then have to upload the binary and the bundle directory to the air gap environment and run (for single node deployments):This will guarantee that all necessary images are present and are copied to all nodes. If you want to install a multi node cluster then you can run, from your machine:
Deploying the infrastructure before deploying the cluster
This PR also contains an experimental support for Terraform infrastructure deployments, see
README.mdfor more details. In a nutshell: you can use HelmVM to deploy your infra and then automatically deploy the cluster on top of it. For that you need to guarantee that your Terraform manifests have a specially craftedoutputsession (again, see theREADME.md) and then you can, from you machine, run something on the lines:This will first apply the infra, when the infra is deployed it will capture the created node IPs and deploy the cluster on the nodes according to what has been defined in your Terraform manifests.
Other
The idea here is to use a good Kubernetes Distribution (
k0son this case) and try to keep it as close to upstream as possible. We can then focus our efforts in developing tools around it that best suits our own needs (e.g. UX, embedding Helm Charts, tooling around infrastructure, etc). With this idea in mind this PR also include a few more things.If you want to bring a node down for maintenance you can, from your remote machine, run :
This also works if you are logged into the Single Node Cluster. NOTE: you have to provide the
node nameeven in a Single Node Deployment, in a future interaction we can allow for omitting thenode nameargument when there is only one node. What this does, behind the scenes, is to drain the node in question. Once the maintenance is done you can bring the node back up with:You can, if you prefer, run
helmvm shelland then drain the node usingkubectlbut the idea is to leave theshellentry for helping out with debug, everything else that is common operation we could dictate what can to be done and in what order therefore we could have entries directly into thehelmvmbinary (similar tonode stopandnode start).Aiming for familiarity
This PR also include some unorthodox ideas. These ideas aimg to bring the experience of using HelmVM close to the experience of using kURL nowadays. This is something we can or not pursuit but it is in this PR nonetheless. Yes, I am talking about
curl | bash. You can stop reading here if you feel like.The functionality of bringing HelmVM closer to the kURL experience is implemented by this PR in the HelmVM Builder Server. I have left a HelmVM Builder Server running online so you can play with it and entertain the idea. A few examples are:
zsh:One last feature that is also present in the HelmVM Builder Server is the capability of building HelmVM binaries that already embed some Helm Charts. See the
README.mdhow to craft a POST request and receive back a binary that already includes your Helm Chart.List of changes