echo $INSTRUQT_GCP_PROJECT_GCPPROJECT_SERVICE_ACCOUNT_KEY | base64 -d > gcloud.json
-oc -n portworx create secret generic px-gcloud --from-file=gcloud.json
-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 @@
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'
Portworx deploys serveral pre-configured storage classes when the storage cluster was created. These storage classes offer a veriety of @@ -401,7 +377,15 @@
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
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
+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 + | +
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
+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.
=== Task 1: Create a new VM
+Start by logging in to the OpenShift console if you haven’t already.
Navigate to the virtualzation > overview menu