Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Openstack Magnum is the Container Infrastructure service, which gives you the possibility to create container clusters like docker-swarm and kubernetes kubernetes clusters as native resources in Openstack. For more information about the service, and offical documentaions, read the user guide and the Magnum Wiki page

...

If you want to use the openstack CLI on your local system, use the lastet version of pythoninstall python3-openstackclient and python3-magnumclient from pip3. Some popular distros has an old version in its repositories, and are known to not work properly. Be sure that your version has this commit includedthe repositories suiting your Operating System. Make sure you install the version corresponding to the Openstack version we are running in production (listed on this Wikis frontpage). On NTNUs logon servers, you should not worry. We've made sure we have the correct version version (smile)

Cluster Templates

To get you started, there is a few public Cluster Templates available in our cloud. These are verified working by us.

NameOSMaster flavorNode flavor
kubernetes-vX.X.XFedora CoreOS 33m1gx1.small2c4rm1gx1.small2c4r
kubernetes-vX.X.X-haFedora CoreOS 33m1gx1.small2c4rm1.small
docker-swarm-templateFedora Atomicm1.smallm1.small
docker-swarm-template-haFedora Atomicm1.smallm1.smallgx1.2c4r

For more information, all templates can be listed with

...

Private templates can be created by users. Please consult the documentation to find which parameters is needed for different Container Orchestration Engines.

Create a cluster

The different container orchestration engines has different parameters. For an extensive and complete list of parameters, check the documentation.

...

ParameterComment
--docker-volume-sizeSize of cinder volume housing docker images and volumes. Defaults to 20GB for our public templates
--master-flavorInstance flavor of VMs running the master node. Defaults to m1gx1.small2c4r for public templates
--flavorInstance flavor of VMs runnin worker nodes. Defaults to m1gx1.small2c4r for public templates
--labels

Override default labels for the give COE. Consult documentation for valid labels for each COE.

Note the labels set in the public templates are there for a reason (wink)

Also note that --labels does not merge by default, so if you want to add labels, please include the labels set in the template as well.

Docker Swarm

This will create Docker Swarm cluster with one master node, and one worker node

Code Block
openstack coe cluster create <clustername> --cluster-template docker-swarm-mode --master-count 1 --node-count 1 --keypair <your keypair>

add --merge-labels as well



Kubernetes

This will create a kubernetes cluster with one master node, and one minionworker

Code Block
$ openstack coe cluster create <clustername> --cluster-template kubernetes-v1.xx.xx --master-count 1 --node-count 1 --keypair <your keypair>


Use a cluster

Docker Swarm

You can interact with your docker swarm with the docker CLI. This must of course be installed on your computer locally first, or you can use the NTNU login-servers (login.stud.ntnu.no for students or login.ansatt.ntnu.no for employees).

Code Block
$ mkdir -p ~/clusters/docker-swarm
$ $(openstack coe cluster config <your-cluster> --output-certs --dir ~/clusters/docker-swarm)

This will generate a client certificate with a corresponding key, download the CA certificate and export some environment variables needes for the docker client in order to communicate with your cluster.

Example, to list the nodes of your docker swarm:

...

...

$ docker node ls
ID                            HOSTNAME                                        STATUS              AVAILABILITY        MANAGER STATUS      ENGINE VERSION
twmj3a98bo6y1swu9zpz4dmig     sverm-r5rpscxldtrc-node-0.novalocal             Ready               Active                                  1.13.1
us5q2whrjdb1rwiqzegc8xi12     sverm-r5rpscxldtrc-node-1.novalocal             Ready               Active                                  1.13.1
6liccpscem1xo6x2a7kbcvtuz *   sverm-r5rpscxldtrc-primary-master-0.novalocal   Ready               Active              Leader              1.13.1

Kubernetes

You can interact with your kubernetes cluster with kubectl. Install it first, if you don't already have it. Install-guide

...

If you want to decrease the number of nodes, what happens depends on your chose chosen COE. If you're running k8s, magnum will try to find a node with no running containers and delete them. If no empty nodes are found, magnum will warn you, and delete a node at random. With docker swarm, magnum have no logic to discover an empty node, and will just delete nodes at random.

Troubleshooting

...