Skip to content

Instantly share code, notes, and snippets.

@glekner
Last active December 7, 2020 11:57
Show Gist options
  • Save glekner/5e659b2cb3a77c3d0707e4b2f4c98ed6 to your computer and use it in GitHub Desktop.
Save glekner/5e659b2cb3a77c3d0707e4b2f4c98ed6 to your computer and use it in GitHub Desktop.
Local Openshift Console + CNV with CodeReady Containers

Openshift Console + CNV | CodeReady Containers

Motive

Running Openshift Console locally with CodeReady Containers is really nice and fast! It is very useful for developers/designers looking to test and create new components.

Prerequisites

  1. Openshift Console - Theres a good chance you already have it! :)
  2. Red Hat Account, Sudo rights

Setup

Deploy OpenShift Local Cluster

Download CRC - https://cloud.redhat.com/openshift/install/crc/installer-provisioned

Navigate to the link above and login with your Red Hat account.

Copy/Save the Pull secret


On the bottom of the page you will see the following section, make sure you save your pull secret.

secret

# Open a terminal in the extracted archive folder and run the following
sudo mv crc /usr/local/bin/

# setup will ask you for the pull secret and your sudo password
crc setup

# initiate the cluster
crc start

Deploy Kubevirt

# change this according to the latest STABLE version
export KUBEVIRT_VERSION=v0.35.0
 
export CDI_VERSION=$(curl -s https://github.com/kubevirt/containerized-data-importer/releases/latest | grep -o "v[0-9]\.[0-9]*\.[0-9]*")

# Create openshift-cnv namespace for Integration Tests
oc create namespace openshift-cnv
 
# Deploy Kubevirt, Storage, CDI Pods
oc create -f https://github.com/kubevirt/kubevirt/releases/download/$KUBEVIRT_VERSION/kubevirt-operator.yaml
 
oc create -f https://github.com/kubevirt/kubevirt/releases/download/$KUBEVIRT_VERSION/kubevirt-cr.yaml

oc create -f https://raw.githubusercontent.com/kubevirt/kubevirt.github.io/master/labs/manifests/storage-setup.yml

oc create -f https://github.com/kubevirt/containerized-data-importer/releases/download/$CDI_VERSION/cdi-operator.yaml

oc create -f https://github.com/kubevirt/containerized-data-importer/releases/download/$CDI_VERSION/cdi-cr.yaml

# Deploy Common Templates
oc project openshift
oc create -f https://raw.githubusercontent.com/MarSik/kubevirt-ssp-operator/master/roles/KubevirtCommonTemplatesBundle/files/common-templates-v0.8.1.yaml
oc project default

Create ConfigMap

This part is required only for working on Integration Tests. Create a YAML file

apiVersion: v1
kind: ConfigMap
metadata:
  name: kubevirt-storage-class-defaults
  namespace: openshift-cnv
data:
  accessMode: ReadWriteOnce
  volumeMode: Filesystem

Import it

kubectl create -f file.yaml

Starting Dev Environment

# if needed, after reboot or crc stop, run crc start again.
# get credentials 
crc console --credentials

oc login -u kubeadmin -p # use the provided credentials from the last cmd.

Connecting Console to our local Cluster

Once all pods are deployed we can initiate our bridge connection

yarn dev # inside frontend/
source ./contrib/oc-environment.sh && ./bin/bridge --k8s-mode-off-cluster-thanos=$(oc -n openshift-monitoring get configmap sharing-config -o jsonpath='{.data.prometheusURL}')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment