This blog post is a short cheat sheet to deploy a pure UBI image as a container with Helm. With the values.yaml in the Helm chart we can configure replica count
of the pods. The deployed containers are only a basic UBI operating system (Red Hat Universal Base Image).
replicaCount: 2
Related GitHub repository
Step 1: Log on to OpenShift
oc login --token=YOUR_TOKEN --server=YOUR_MASTERNODE_SERVER
Step 2: Create an OpenShift project
export PROJECT_NAME=obi-helm
oc new-project $PROJECT_NAME
Step 3: Clone the repository
git clone https://github.com/thomassuedbroecker/ubi-helm.git
Step 4: Navigate to the helm chart
export CHART_NAME=ubi-helm
cd ./charts/$CHART_NAME
Step 5: Verify the values.yaml for the replica count
cat values.yaml
- Example output:
# Default values for chart.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
replicaCount: 2
image:
repository: "ubi8/ubi"
tag: latest
Step 6: Verify the helm chart
- Dependency update
- Lint
- To check the generated manifests of a release without installing the chart, the ‘–debug’ and ‘–dry-run’ flags can be combined.
helm dependency update .
helm install --dry-run --debug $CHART_NAME .
helm lint
Step 7: (optional) Create a Helm package
helm package .
- Example output:
Successfully packaged chart and saved it to: /ubi-helm/charts/ubi-helm/ubi-helm-v1.0.0.tgz
Step 7: Install helm chart
helm install $CHART_NAME .
Step 8: Verify the running pod
oc get pods
POD=$(oc get -n $PROJECT_NAME pods | grep $CHART_NAME | head -n 1 | awk '{print $1;}')
oc exec -n $PROJECT_NAME $POD --container $CHART_NAME -- ls
- Example output:
NAME READY STATUS RESTARTS AGE
ubi-helm-ubi-helm-74d44b5c77-tzbcb 1/1 Running 7 (22s ago) 10m
ubi-helm-ubi-helm-74d44b5c77-wljvr 1/1 Running 7 (27s ago) 10m
bin
boot
dev
etc
home
...
Step 9: Uninstall helm chart
helm uninstall $CHART_NAME
I hope this was useful to you and let’s see what’s next?
Greetings,
Thomas
#helmchart, #UBI, #openshift, #cheatsheet
Leave a Reply