My experience learning Kubernetes 2/x

Jose Ferro
4 min readFeb 23, 2023

In the first part I set up my mac to start with kubernetes and Docker to set up a cluster for a jupyterHub environement.

The goal is to further document “live” what happens when following the steps in:

remember I am learning kubernetes and I want to set up a cluster with a jupyter hub environment running on it.

Normally you dont find many articles describing all what can go wrong, well here is one.

We need to operate with something called helm.

helm repo add jupyterhub https://jupyterhub.github.io/helm-chart/

adds the JupyterHub Helm chart repository to your Helm installation. The repository is given the name "jupyterhub" for convenience.

helm repo update

updates your local list of available Helm charts from all the added repositories, including the newly added JupyterHub repository. This ensures that you have the latest version of the JupyterHub chart available to install.

But, what is a Helm chart repository?

The theory:

A Helm chart repository is a storage location for Helm charts, which are packages of pre-configured Kubernetes resources. A chart repository can be thought of as a collection of Helm charts that can be installed and managed using the Helm package manager.

A chart repository can be hosted on a remote server, such as a public repository, or on a local machine. When a chart is published to a repository, other users can discover and install the chart, along with any dependent charts.

Helm provides a command-line interface for managing chart repositories.

Since I see (so far) kubernetes as a tool to orchestrate and organize sharing computational resources (RAM, CPU, disc space, etc) I interpreted (so far in my learning process) a Helm chart being a YAML file that specifies which resources and which code has to be deployed in the diferent PODS of the cluster.

This is a minimal example of a Helm chart:

my-chart/
├── Chart.yaml
└── templates/
└── deployment.yaml

In this example, my-chart is the name of the chart. Here's the contents of the files:

Chart.yaml

apiVersion: v2
name: my-chart
description: A minimal Helm chart
version: 0.1.0

templates/deployment.yaml:

apiVersion: apps/v1
kind: Deployment
metadata:
name: my-deployment
spec:
replicas: 1
selector:
matchLabels:
app: my-app
template:
metadata:
labels:
app: my-app
spec:
containers:
— name: my-container
image: my-image:latest

This chart defines a single Kubernetes deployment that runs one replica of a container with the my-image:latest image. The deployment is created with the name my-deployment, and the pod created by the deployment is labeled with app: my-app.

This is just a very simple example, but Helm charts can contain many more resources, such as services, config maps, and secrets, and can be used to deploy complex applications to Kubernetes clusters.

Going on with the goal of installing jupyterHub:

helm repo add jupyterhub https://jupyterhub.github.io/helm-chart/
helm repo update

kubectl cluster-info dump

The connection to the server 127.0.0.1:51011 was refused — did you specify the right host or port?

It turns out that Docker has to be running, so I start Docker from the applications folder.

Running Docker was a party in his own. It does not start from the applications folder in my mac. Some tricks are needed.

Lets start minikube

minikube start

Done! kubectl is now configured to use “minikube” cluster and “default” namespace by default.

Looks good. well les see

kubectl get pods

No resources found in default namespace.

curl https://raw.githubusercontent.com/helm/helm/HEAD/scripts/get-helm-3 | bash

(this installed HELM)

Update Complete. ⎈Happy Helming!⎈

helm repo add jupyterhub https://jupyterhub.github.io/helm-chart/

“jupyterhub” already exists … Update Complete. ⎈Happy Helming!⎈

You have successfully installed the official JupyterHub Helm chart!

### Installation info

- Kubernetes namespace: k8s-namespace-jose

- Helm release name: helm-release-name-jose

- Helm chart version: 2.0.0

- JupyterHub version: 3.0.0

- Hub pod packages: See https://github.com/jupyterhub/zero-to-jupyterhub-k8s/blob/2.0.0/images/hub/requirements.txt

kubectl get ns

The connection to the server 127.0.0.1:51011 was refused — did you specify the right host or port?

I got this error a million times. lets try to solve it.

kubectl get pods

the hub pod is the one containing the jupyter hub.

But how do I access the application in the browser?

I have to say that so far this is the end of the journey for today. I already had the suspition that when a user guide somehow states “just follows these 4 steps and its done” it is the prove that the guide was done by a super proficience computer science guy who forgot long ago all the troubles anyone not haveing 3 phds in data science might encounter.

after running:

kubectl describe svc

I get all the ips of the services and pods.

No way I am able to access the dam application on the browser. After tens and tens of questions to chatgpt, nothing works and I keep getting from safari: safari coulnt connect to server xx.x..x.x (whatever IP I try)

Stackoverflow at the resque:

No answer.

So at the moment I can only say “hasta la vista babe”

--

--

Jose Ferro

Python coder. NLP. Pandas. Currently heavily involved with ipywidgets (ipysheet, ipyvuetify, ipycytoscape)