Difference between revisions of "Tutorials:Install the Kubernetes infrastructure"

From Collective Computational Unit
Jump to navigation Jump to search
m (Install Kubernetes packages)
m
 
(2 intermediate revisions by the same user not shown)
Line 23: Line 23:
 
== Connecting to the CCU cluster ==
 
== Connecting to the CCU cluster ==
  
Now that you have kubectl running, attach it to our CCU compute cluster by executing the following steps:
+
Now that you have kubectl running, attach it to our CCU compute cluster and set up your user account by following [[Tutorials:Set_up_your_Kubernetes_user_account|the next step of the tutorial]].
* Generate a new directory ".kube" in your home directory to host Kubernetes configuration files.
 
* Download the following linked file called "config" and place it in the ".kube" directory.
 
* Modify the file: replace <your.username> with your CCU username.
 
  
If you looked at the file a bit, you have now set up a context called "ccu" to run kubectl commands, which contains information about where to find the cluster. Switch to the context with
 
  
<syntaxhighlight lang="bash">
+
[[Category:Tutorials]]
> kubectl config use-context ccu
 
</syntaxhighlight>
 
 
 
You have not set up any user credentials yet. If you try any kubectl command such as
 
 
 
<syntaxhighlight lang="bash">
 
> kubectl cluster-info dump
 
</syntaxhighlight>
 
 
 
you will get asked for username and password. Note that your CCU account does not work here, the process to get credentials is unfortunately a bit more involved and covered in the next step of the tutorial. However, this  shows that kubectl is now attached successfully to the cluster.
 

Latest revision as of 09:12, 18 June 2019

Install Kubernetes packages

If you want to run containers on your own system, make sure to first follow all previous guides. If you just want to use the cluster, it is sufficient to install Kubernetes kubectl command line tool as follows:

#!/bin/bash
sudo apt install snap
sudo snap install kubectl --classic

At this point you might need to reboot or at least relog to add snap to your path, if it was not already installed previously. Try out the installation with

> kubectl version
Client Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.2", GitCommit:"66049e3b21efe110454d67df4fa62b08ea79a19b", GitTreeState:"clean", BuildDate:"2019-05-16T16:23:09Z", GoVersion:"go1.12.5", Compiler:"gc", Platform:"linux/amd64"}
The connection to the server localhost:8080 was refused - did you specify the right host or port?

TODO: The version of kubernetes running on the cluster is 1.14.2., it might be necessary that they match. We should test this at some point.

You have now installed kubectl. This is a command line tool which lets you talk to Kubernetes clusters (such as our CCU compute cluster). The last error message means that kubectl did not detect a running kubernetes cluster on your local host, which probably does not come as a surprise. We will now connect to the CCU cluster.

Connecting to the CCU cluster

Now that you have kubectl running, attach it to our CCU compute cluster and set up your user account by following the next step of the tutorial.