Introduction
In this guide we will learn how to deploy Single Node OpenShift (SNO) 4.10 as we do for several of our clients. The SNO is a good solution for testing your application without the need for an entire OpenShift cluster. Unlike the previous Kubespray Deployments post, in this case we only use one instance for an entire OpenShift deployment.
We will install it by preparing manually an ISO file and boot it to the needed environment.
Prerequisites
- A preparation VM to run the commands for preparing the ISO
- A VM that will boot from that ISO
Procedure or How to deploy
Let’s Prepare the DNS records for the SNO installation:
- api.sno.customers.k8s.co.il – Kubernetes API address
- api-int.sno.customers.k8s.co.il – Internal API address
- *.apps.sno.customers.k8s.co.il – Ingress route
Preparation VM
Boot a preparation server and ssh to it. For this we will use RHEL 8.7.
Attach the subscriptions needed
$ subscription-manager register
Username: <REDHATUSER>
Password:
The system has been registered with ID: xxxxxxxxx-yyyyy-zzzz-aaaa-bbbbbbbbbbbb
The registered system name is: sno
$ subscription-manager attach --pool=2c94xxxxxxxxxxxxxxxxxxxxxxxxx67b0a
Install necessary packages:
$ dnf install podman
- Download the oc client. At the time of this writing the versions is 4.10.53.
NOTE: You can also download the ‘latest’, but as we require a stable procedure we will use a specific version
$ mkdir -p /opt/octopus/sno
$ cd /opt/octopus/sno
$ VERSION=4.10.53
$ curl -k https://mirror.openshift.com/pub/openshift-v4/clients/ocp/$VERSION/openshift-client-linux.tar.gz > oc-$VERSION.tar.gz
$ tar zxf oc-$VERSION.tar.gz
$ chmod +x oc
- Download the OpenShift installer:
$ curl -k https://mirror.openshift.com/pub/openshift-v4/clients/ocp/$VERSION/openshift-install-linux.tar.gz > openshift-install-linux-$VERSION.tar.gz
$ tar zxvf openshift-install-linux-$VERSION.tar.gz
$ chmod +x openshift-install
- Check the ISO_URL
$ ISO_URL=$(./openshift-install coreos print-stream-json | grep location | grep x86_64 | grep iso | cut -d\" -f4)
$ echo $ISO_URL
https://rhcos.mirror.openshift.com/art/storage/releases/rhcos-4.10/410.84.202210040010-0/x86_64/rhcos-410.84.202210040010-0-live.x86_64.iso
- Download the ISO
$ curl -L $ISO_URL > rhcos-live.x86_64.iso
Prepare the install-config.yaml file:
apiVersion: v1
baseDomain: customers.k8s.co.il
compute:
- name: worker
replicas: 0
controlPlane:
name: master
replicas: 1
metadata:
name: sno
networking:
clusterNetwork:
- cidr: 10.128.0.0/14
hostPrefix: 23
serviceNetwork:
- 172.30.0.0/16
platform:
none: {}
bootstrapInPlace:
installationDisk: /dev/vda
pullSecret: 'PULL_SECRET_FROM_REDHAT'
sshKey: 'YOUR_SSH_PUBLIC_KEY'
- Download the pull secret from your user at Red Hat on this link: https://console.redhat.com/openshift/install/pull-secret
Generate OpenShift assets:
$ mkdir $(date '+%d.%m')
$ cp install-config.yaml $(date '+%d.%m')/
$ ./openshift-install --dir=$(date '+%d.%m') create single-node-ignition-config
- Embed the ignition files into the ISO
$ alias coreos-installer='podman run --privileged --pull always --rm \
-v /dev:/dev -v /run/udev:/run/udev -v $PWD:/data \
-w /data quay.io/coreos/coreos-installer:release'
$ cp $(date '+%d.%m')/bootstrap-in-place-for-live-iso.ign iso.ign
$ coreos-installer iso ignition embed -fi iso.ign rhcos-live.x86_64.iso
See the following output
Trying to pull quay.io/coreos/coreos-installer:release...
Getting image source signatures
Copying blob d882444b85a3 done
Copying blob 4b0f320c94da done
Copying blob a5bf0747400a done
Copying config 246a91e0c2 done
Writing manifest to image destination
Storing signatures
We now have a working ISO that we can boot for an SNO server!
Boot from the ISO and check using the verification commands below
Monitoring & Verification
Check the server is healthy with the following commands:
- Monitor the installation:
$ ./openshift-install --dir=ocp wait-for install-complete
- Verify:
$ export KUBECONFIG=ocp/auth/kubeconfig
$ oc get nodes
$ oc get clusterversion
Conclusion
Installing the SNO is fairly simple. Note that if installing on a cloud infrastructure the ISO needs to be ‘ejected’ in someway. For example, installing on OpenStack required us to clone the vda disk to a new instance in order to continue the boot. You now know how to deploy Single Node OpenShift (SNO) 4.10.
Enjoy.