diff --git a/content/modules/ROOT/pages/pxe-osv-01.adoc b/content/modules/ROOT/pages/pxe-osv-01.adoc index 0c39d0d..138a84d 100644 --- a/content/modules/ROOT/pages/pxe-osv-01.adoc +++ b/content/modules/ROOT/pages/pxe-osv-01.adoc @@ -183,7 +183,7 @@ configurations. Storage Classes are not specific to Openshift or Virtualization, but we still need a storage class to provision virtual machine disks. -=== Task 1: View existing storage classes +=== Task: View existing storage classes Portworx deploys serveral pre-configured storage classes when the storage cluster was created. These storage classes offer a veriety of @@ -208,7 +208,7 @@ We can see in the terminal output a list of parameters. This isn’t exactly what we want for our new virtual machines, so let’s create a new storage class. -=== Task 2: Create a new storage class for VMs +=== Task: Create a new storage class for VMs First, let's set the `gp3-csi` StorageClass to no longer be the default: @@ -289,4 +289,93 @@ For further details on storage clusters, see the https://docs.openshift.com/container-platform/4.16/virt/storage/virt-configuring-storage-profile.html)[Openshift documentation^]. -We can now create virtual machines using our new storage profile! + +== Install and Configure Openshift Virtualization + + +=== Task: Install the Kubevirt Hyperconverged Operator + + +We can install the namespace, OperatorGroup and Subscription using the following command: + +[source,sh,role=execute] +---- +cat << EOF | oc apply -f - + +apiVersion: v1 +kind: Namespace +metadata: + name: openshift-cnv +--- +apiVersion: operators.coreos.com/v1 +kind: OperatorGroup +metadata: + name: kubevirt-hyperconverged-group + namespace: openshift-cnv +spec: + targetNamespaces: + - openshift-cnv +--- +apiVersion: operators.coreos.com/v1alpha1 +kind: Subscription +metadata: + name: hco-operatorhub + namespace: openshift-cnv +spec: + source: redhat-operators + sourceNamespace: openshift-marketplace + name: kubevirt-hyperconverged + startingCSV: kubevirt-hyperconverged-operator.v4.16.2 + channel: "stable" + config: + env: + - name: KVM_EMULATION + value: "true" +EOF +---- + +The operator can take a few moments to install + + +=== Task: Install the HyperConverged CR + + +We can install the HyperConverged CR using the following command: + +[source,sh,role=execute] +---- +cat << EOF > ocp-osv-obj.yaml +apiVersion: hco.kubevirt.io/v1beta1 +kind: HyperConverged +metadata: + name: kubevirt-hyperconverged + namespace: openshift-cnv +spec: + filesystemOverhead: + global: "0.08" +EOF +---- + + +==== +[NOTE] + +It is possible to install the Operator and HyperConverged object using the Openshift UI. We have opted to use +the CLI to make the process more repeatable +==== + +=== Task: Install Virtctl + +Many functions we will use rely on a utility called `virtctl`. Virtctl allows us to interface with our virtual +machine through the control plane of Openshift. This means that we will not have to configure Openshift Networking +to interact with our virtual machines. + +[source,sh,role=execute] +---- +wget $(oc get consoleclidownload virtctl-clidownloads-kubevirt-hyperconverged -o json | jq -r '.spec.links[] | select(.text == "Download virtctl for Linux for x86_64") | .href') +tar -xvf virtctl.tar.gz +chmod +x virtctl +sudo mv virtctl /usr/local/bin +---- + +With Portworx and OSV installed, we are now ready to move on to the next lesson. \ No newline at end of file diff --git a/www/modules/index.html b/www/modules/index.html index ab67ff0..7f02c06 100644 --- a/www/modules/index.html +++ b/www/modules/index.html @@ -5,7 +5,7 @@ Using Portworx with OpenShift Virtualization :: Using Portworx with OpenShift Virtualization - + diff --git a/www/modules/pxe-osv-01.html b/www/modules/pxe-osv-01.html index c3ab891..c9009c1 100644 --- a/www/modules/pxe-osv-01.html +++ b/www/modules/pxe-osv-01.html @@ -6,7 +6,7 @@ Untitled :: Using Portworx with OpenShift Virtualization - + @@ -206,35 +206,11 @@

-

Installing the the Portworx StorageCluster requires a few steps. We need -to ensure that we have a service account secret for our gcloud -environment to create and manage disks. Portworx will create and expand -GCP disks based on our specifications.

- -
-

Create this secret by running:

-
-
-
-
echo $INSTRUQT_GCP_PROJECT_GCPPROJECT_SERVICE_ACCOUNT_KEY | base64 -d > gcloud.json
-oc -n portworx create secret generic px-gcloud --from-file=gcloud.json
-
-
-
-

We can now grab our StorageCluster specification:

-
-
-
-
curl -o px-spec.yaml "https://install.portworx.com/3.1?operator=true&mc=false&kbver=1.29.8&ns=portworx&b=true&iop=6&s=%22type%3Dpd-standard%2Csize%3D50%22&ce=gce&r=17001&c=px-cluster&osft=true&stork=true&csi=true&mon=true&tel=false&st=k8s&promop=true"
-
-
-
-

We now need to insert a reference for our secret in to our -StorageCluster specification. This can be done with a little yq magic:

+

Grab our StorageCluster specification:

-
yq -iy '.spec.volumes += [{"name": "gcloud", "mountPath": "/etc/pwx/gce", "secret": {"secretName": "px-gcloud"}}] | .spec.env += [{"name": "GOOGLE_APPLICATION_CREDENTIALS", "value": "/etc/pwx/gce/gcloud.json"}]' px-spec.yaml
+
curl -o px-spec.yaml 'https://install.portworx.com/3.1?operator=true&mc=false&kbver=1.29.10&ns=portworx&b=true&iop=6&s=%22type%3Dgp3%2Csize%3D50%22%2C%22&ce=aws&r=17001&c=px-cluster-443e64d8-f2c7-47d2-b81b-295567465a84&osft=true&stork=true&csi=true&tel=false&st=k8s'
@@ -336,8 +312,8 @@

-
echo "alias pxctl='PX_POD=\$(oc get pods -l name=portworx -n portworx --field-selector=status.phase==Running | grep \"1/1\" | awk \"NR==1{print \$1}\") && oc exec \$PX_POD -n portworx -- /opt/pwx/bin/pxctl'" >> /root/.profile
-source /root/.profile
+
echo "alias pxctl='PX_POD=\$(oc get pods -l name=portworx -n portworx --field-selector=status.phase==Running | grep \"1/1\" | awk \"NR==1{print \$1}\") && oc exec \$PX_POD -n portworx -- /opt/pwx/bin/pxctl'" >> ~/.bashrc
+source ~/.bashrc

@@ -371,7 +347,7 @@

-

Task 1: View existing storage classes

+

Task: View existing storage classes

Portworx deploys serveral pre-configured storage classes when the storage cluster was created. These storage classes offer a veriety of @@ -401,7 +377,15 @@

-

Task 2: Create a new storage class for VMs

+

Task: Create a new storage class for VMs

+
+

First, let’s set the gp3-csi StorageClass to no longer be the default:

+
+
+
+
oc patch storageclass gp3-csi -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"false"}}}'
+
+

Run the following command to create a new yaml file for the block-based StorageClass configuration:

@@ -475,7 +459,7 @@

-
oc get storageprofile px-csi-vm-example -o yaml
+
oc get storageprofile px-csi-vm -o yaml

+
+
+ +
+

Install and Configure Openshift Virtualization

+
+
+

Task: Install the Kubevirt Hyperconverged Operator

-

We can now create virtual machines using our new storage profile!

+

We can install the namespace, OperatorGroup and Subscription using the following command:

+
+
+
+
cat << EOF | oc apply -f -
+
+apiVersion: v1
+kind: Namespace
+metadata:
+  name: openshift-cnv
+---
+apiVersion: operators.coreos.com/v1
+kind: OperatorGroup
+metadata:
+  name: kubevirt-hyperconverged-group
+  namespace: openshift-cnv
+spec:
+  targetNamespaces:
+    - openshift-cnv
+---
+apiVersion: operators.coreos.com/v1alpha1
+kind: Subscription
+metadata:
+  name: hco-operatorhub
+  namespace: openshift-cnv
+spec:
+  source: redhat-operators
+  sourceNamespace: openshift-marketplace
+  name: kubevirt-hyperconverged
+  startingCSV: kubevirt-hyperconverged-operator.v4.16.2
+  channel: "stable"
+  config:
+    env:
+    - name: KVM_EMULATION
+      value: "true"
+EOF
+
+
+
+

The operator can take a few moments to install

+
+
+
+

Task: Install the HyperConverged CR

+
+

We can install the HyperConverged CR using the following command:

+
+
+
+
cat << EOF > ocp-osv-obj.yaml
+apiVersion: hco.kubevirt.io/v1beta1
+kind: HyperConverged
+metadata:
+  name: kubevirt-hyperconverged
+  namespace: openshift-cnv
+spec:
+  filesystemOverhead:
+    global: "0.08"
+EOF
+
+
+
+
+
+ + + + + +
+ + +It is possible to install the Operator and HyperConverged object using the Openshift UI. We have opted to use +the CLI to make the process more repeatable +
+
+
+
+
+
+

Task: Install Virtctl

+
+

Many functions we will use rely on a utility called virtctl. Virtctl allows us to interface with our virtual +machine through the control plane of Openshift. This means that we will not have to configure Openshift Networking +to interact with our virtual machines.

+
+
+
+
wget $(oc get consoleclidownload virtctl-clidownloads-kubevirt-hyperconverged  -o json | jq -r '.spec.links[] | select(.text == "Download virtctl for Linux for x86_64") | .href')
+tar -xvf virtctl.tar.gz
+chmod +x virtctl
+sudo mv virtctl /usr/local/bin
+
diff --git a/www/modules/pxe-osv-02.html b/www/modules/pxe-osv-02.html index 0933928..794438b 100644 --- a/www/modules/pxe-osv-02.html +++ b/www/modules/pxe-osv-02.html @@ -6,7 +6,7 @@ Untitled :: Using Portworx with OpenShift Virtualization - + @@ -208,20 +208,24 @@

virtctl ssh cloud-user@centos-stream9-example -i ~/.ssh/id_rsa -t "-o StrictHostKeyChecking=no"

-
-

== Step 2 - Deploy a Virtual Machine using the Openshift Console

-
-

Start by logging in to the OpenShift console if you haven’t already.

+ +
+

Step 2 - Deploy a Virtual Machine using the Openshift Console

+
-

=== Task 1: Create a new VM

+

Start by logging in to the OpenShift console if you haven’t already.

+
+

Task 1: Create a new VM

Navigate to the virtualzation > overview menu

@@ -282,8 +286,6 @@

1. Install Portworx 3. Live Migrations and HA diff --git a/www/modules/pxe-osv-03.html b/www/modules/pxe-osv-03.html index 1bb2960..238f1ad 100644 --- a/www/modules/pxe-osv-03.html +++ b/www/modules/pxe-osv-03.html @@ -6,7 +6,7 @@ Untitled :: Using Portworx with OpenShift Virtualization - +