Building and Installing the MicroShift RPMs

Building and installing the MicroShift RPMs for local development

Building the RPMs

MicroShift binary with systemd unit file and the required SELinux submodule can be built as an RPM using make on an RPM-based distribution.

Install the MicroShift build dependencies and the RPM specific build-time packages.

sudo dnf install -y git golang rpm-build selinux-policy-devel container-selinux

Clone the repository and cd into it:

git clone https://github.com/redhat-et/microshift.git
cd microshift

Build the SELinux and MicroShift RPMs with:

make rpm

RPMs will be placed in ./packaging/rpm/_rpmbuild/RPMS/. There are two RPMs that will be required to install:

packaging/rpm/_rpmbuild/RPMS/noarch/microshift-selinux-*
packaging/rpm/_rpmbuild/RPMS/x86_64/microshift-*

Installing the RPMs

Enable the CRI-O repository:

command -v subscription-manager &> /dev/null \
    && subscription-manager repos --enable rhocp-4.8-for-rhel-8-x86_64-rpms

sudo dnf module enable -y cri-o:1.21

curl -L -o /etc/yum.repos.d/devel:kubic:libcontainers:stable.repo https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/CentOS_8_Stream/devel:kubic:libcontainers:stable.repo
curl -L -o /etc/yum.repos.d/devel:kubic:libcontainers:stable:cri-o:1.21.repo https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable:cri-o:1.21/CentOS_8_Stream/devel:kubic:libcontainers:stable:cri-o:1.21.repo

Install the MicroShift and the SELinux policies:

sudo dnf localinstall -y packaging/rpm/_rpmbuild/RPMS/noarch/microshift-selinux-*
sudo dnf localinstall -y packaging/rpm/_rpmbuild/RPMS/x86_64/microshift-*

Running the RPMs

Start CRI-O and MicroShift services:

sudo systemctl enable crio --now
sudo systemctl enable microshift --now

To install OpenShift and Kubernetes clients, follow Getting Started: Install Clients.

To configure the kubeconfig, follow Getting Started: Copy Kubeconfig.

It is now possible to run oc or kubectl commands against the MicroShift environment.

Verify that MicroShift is running:

oc get pods -A

You can stop MicroShift service with systemd:

sudo systemctl stop microshift

Check MicroShift with

sudo podman ps
sudo critcl ps

For more on running MicroShift, refer to the user documentation

Last modified May 24, 2022 at 4:02 PM PST : typo do -> to (#168) (77030fc)
Last modified May 24, 2022 at 4:02 PM PST : typo do -> to (#168) (77030fc)