Platform Kubernetes - padogrid/padogrid GitHub Wiki

◀️ Platform: Docker :link: PadoGrid on OCI Compute ▶️


Kubernetes This section provides instructions for starting and running a PadoGrid pod in Kubernetes.


Starting PadoGrid Pod

The padogrid.yaml file maintained in the PadoGrid repo deploys a single replica of PadoGrid container.

Kubernetes

kubectl apply -f https://raw.githubusercontent.com/padogrid/padogrid/develop/padogrid-deployment/src/main/resources/common/k8s/padogrid.yaml

To access JupyterLab running in the PadoGrid container, you may need to forward its port to your host OS.

kubectl port-forward svc/padogrid 8888

✏️ Depending on the bundle you are installing, additional port numbers may need to be forwarded. Please see the bundle instructions for details.

Once the pod is started, from the browser, login to JupyerLab as follows.

You can also login directly to the PadoGrid pod as follows.

kubectl exec -it padogrid -- bash

OpenShift

PadoGrid runs as a non-root user (padogrid/1001). To run a non-root user container in OpenShift, we need to add the project's default user to the nonroot SSC (Security Context Constraints).

# Create project
oc new-project padogrid

# Add the nonroot SCC to the 'default' user in the 'padogrid' project
oc adm policy add-scc-to-user nonroot system:serviceaccount:padogrid:default

Apply the padogrid.yaml maintained in the PadoGrid repo.

oc apply -f https://raw.githubusercontent.com/padogrid/padogrid/develop/padogrid-deployment/src/main/resources/common/k8s/padogrid.yaml

To login to PadoGrid via JupyerLab:

oc expose svc padogrid --port 8888

✏️ Depending on the bundle you are installing, additional port numbers may need to be exposed. Please see the bundle instructions for details.

View the exposed route:

oc get route

Output:

NAME       HOST/PORT                            PATH   SERVICES   PORT   TERMINATION   WILDCARD
padogrid   padogrid-padogrid.apps-crc.testing          padogrid   8888                 None

The HOST/PORT column shows the JupyterLab address.

JupyterLab URL: http://padogrid-padogrid.apps-crc.testing

To login directly to the PadoGrid pod, use the PadoGrid pod name:

oc get pods

Output:

NAME                        READY   STATUS    RESTARTS   AGE
padogrid-556797b799-57cg4   1/1     Running   0          4m4s

Login:

# Login to padogrid pod
oc exec -it padogrid-556797b799-57cg4 -- bash

Changing JupyterLab Password

To change the JupyterLab password, follow the steps below.

  • Login to PadoGrid as described above.
  • Enter a new password by running the following.
jupyter server password
  • Stop the JupyterLab instance. The following will stop the JupyterLab instance and the PadoGrid container will automatically restart a new instance. You will need to refresh your browser for the new password to get activated.
stop_jupyter

Running GUI Apps from Container

For bundles that are equipped with GUI apps, you can use X11 to display them on your host OS.

X11 PadoGrid Docker Image: 0.9.28+

The PadoGrid container image versions previous to 0.9.28 do not include X11 client packages, and hence, you must install them manually.

1. From the host OS

First, install and run an X11 server on your host OS following the link that applies to your OS.

  • macOS: XQuartz
  • Windows: Xming, MobaXterm
  • Linux: Use the package manager to install X11 packages. For example, on Ubuntu, sudo apt install xorg openbox.

Upon completion of installing and running X11, list the display authorization entries.

xauth list

Output:

myhost.local:0  MIT-MAGIC-COOKIE-1  2a7842352bdc123b2cf92c01bf0e822b

Your output may contain more than one (1) entry. We need the one with the host name that the containers can access. For Docker Kubernetes and Minikube, you can use the entry as is. However, for OphenShift Local (CRC), you need to use the host OS IP address. For our example, we can replace the host name with its IP address (192.168.1.10) as follows.

192.168.1.10:0  MIT-MAGIC-COOKIE-1  2a7842352bdc123b2cf92c01bf0e822b

✏️ The trailing number, :0 indicates the primary monitor. If you have a second monitor, it would be :1.

2. From inside the container

Copy/paste the display authorization entry to the xauth add command and set the DISPLAY environment variable as follows.

touch ~/.Xauthority
xauth add 192.168.1.10:0  MIT-MAGIC-COOKIE-1  2a7842352bdc123b2cf92c01bf0e822b
export DISPLAY=192.168.1.10:0

To test GUI apps, install and run Hazelcast Desktop.

install_padogrid -product hazelcast-desktop
update_padogrid -product hazelcast-desktop
install_app -product hazelcast -app desktop
cd_app desktop/bin_sh
./desktop

The desktop app window should display on your primary screen.

Teardown

Docker Kubernetes and Minikube:

kubectl delete -f https://raw.githubusercontent.com/padogrid/padogrid/develop/padogrid-deployment/src/main/resources/common/k8s/padogrid.yaml

OpenShift Local (CRC):

oc delete -f https://raw.githubusercontent.com/padogrid/padogrid/develop/padogrid-deployment/src/main/resources/common/k8s/padogrid.yaml
oc delete serviceaccounts myserviceaccount

◀️ Platform: Docker :link: PadoGrid on OCI Compute ▶️