First Steps
In this tutorial, we will interact with the Kubernetes cluster for the first time.
Warning
Please make sure you completed Setup before you continue with this tutorial.
Login
To login to the stepping stone cluster head over to the Stepping Stone Wiki.
There you will find the login information for the cluster.
Also you can copy the kubeconfig
file from the wiki to your local machine. (e.g. ~/.kube/config
)
Note
You can rename the context in the kubeconfig
file to stepping-stone
to make it easier to use. There are also some cli tools which improve the observability of the cluster context. (e.g. oh-my-zsh
)
Warning
For this tutorial you can also use a local minikube cluster. But some parts of the tutorial will not work as expected. (e.g. the ingress, storage, etc.)
Namespaces
As a first step on the cluster, we are going to create a new Namespace.
A Namespace is a logical design used in Kubernetes to organize and separate your applications, Deployments, Pods, Ingresses, Services, etc. on a top-level basis. Take a look at the Kubernetes docs. Authorized users inside a namespace are able to manage those resources. Namespace names have to be unique in your cluster.
Task 1: Create a new Namespace
Create a new namespace in the tutorial environment.
The kubectl help
output can help you figure out the right command.
Note
Please choose an identifying name for your Namespace, e.g. your initials
or name as a prefix
.
We are going to use <namespace>
as a placeholder for your created Namespace.
Solution
kubectl create namespace <namespace>
# export it as an environment variable for later use (will be mentioned in the tutorial)
export NAMESPACE=<namespace>
Note
By using the following command, you can switch into another Namespace instead of specifying it for each kubectl
command.
Linux/MacOS:
kubectl config set-context $(kubectl config current-context) --namespace <namespace>
Windows:
kubectl config current-context
SET KUBE_CONTEXT=[Insert output of the upper command]
kubectl config set-context %KUBE_CONTEXT% --namespace <namespace>
Some prefer to explicitly select the Namespace for each kubectl
command by adding --namespace <namespace>
or -n <namespace>
.
Others prefer helper tools like kubens
.