Add step for configuring hybrid networking.

This commit is contained in:
2024-05-27 07:37:53 +12:00
parent 0248e74d55
commit 522b9dd5ff
2 changed files with 46 additions and 17 deletions

View File

@ -11,7 +11,7 @@ summary: "Preparing our cluster for windows machines."
In this first hands on excercise we will prepare our cluster for running Windows nodes by installing an operator and configuring it. In this first hands on excercise we will prepare our cluster for running Windows nodes by installing an operator and configuring it.
[Operatps](https://docs.openshift.com/container-platform/4.15/operators/index.html) are among the most important components of OpenShift Container Platform. Operators are the preferred method of packaging, deploying, and managing additional cluster services or application. [Operators](https://docs.openshift.com/container-platform/4.15/operators/index.html) are among the most important components of OpenShift Container Platform. Operators are the preferred method of packaging, deploying, and managing additional cluster services or application.
To install Operators on OpenShift we use Operator Hub. A simplistic way of thinking about Operator Hub is as the "App Store" for your OpenShift cluster. To install Operators on OpenShift we use Operator Hub. A simplistic way of thinking about Operator Hub is as the "App Store" for your OpenShift cluster.
@ -21,8 +21,36 @@ To install Operators on OpenShift we use Operator Hub. A simplistic way of think
| *OpenShift Operator Hub* | | *OpenShift Operator Hub* |
</Zoom> </Zoom>
## 2.1 - Enable hybrid networking
## 2.1 - Install the windows machine config operator As a cluster administrator, you can configure a Red Hat OpenShift cluster network to allow Linux and Windows nodes to host Linux and Windows workloads, respectively.
This requires enabling a feature called **[hybrid networking](https://docs.openshift.com/container-platform/4.15/networking/ovn_kubernetes_network_provider/configuring-hybrid-networking.html#configuring-hybrid-ovnkubernetes)**.
To configure hybrid networking, run the following command in your bastion host terminal:
```bash
oc patch networks.operator.openshift.io cluster --type=merge \
-p '{
"spec":{
"defaultNetwork":{
"ovnKubernetesConfig":{
"hybridOverlayConfig":{
"hybridClusterNetwork":[
{
"cidr": "10.132.0.0/14",
"hostPrefix": 23
}
]
}
}
}
}
}'
```
## 2.2 - Install the windows machine config operator
If you have a running OpenShift cluster, you can install the optional **Windows Machine Config Operator** to configure Windows machines into nodes, enabling Windows container workloads to be ran within your OpenShift cluster. If you have a running OpenShift cluster, you can install the optional **Windows Machine Config Operator** to configure Windows machines into nodes, enabling Windows container workloads to be ran within your OpenShift cluster.
@ -43,7 +71,7 @@ Follow the steps below to install the operator:
> Note: The operator installation may take several minutes to complete. Wait for the status of `succeeded` before continuing with the following step. > Note: The operator installation may take several minutes to complete. Wait for the status of `succeeded` before continuing with the following step.
> >
## 2.2 - Create configuration secrets ## 2.3 - Create configuration secrets
The windows machine config operator expects a secret to be present in its namespace called `cloud-private-key` containing a private key. This private key will be used to log into the soon to be provisioned Windows machine and set it up as an OpenShift node. The windows machine config operator expects a secret to be present in its namespace called `cloud-private-key` containing a private key. This private key will be used to log into the soon to be provisioned Windows machine and set it up as an OpenShift node.

View File

@ -34,21 +34,23 @@ Below is a yaml snippet we will use as base to create our `MachineSet`:
apiVersion: machine.openshift.io/v1beta1 apiVersion: machine.openshift.io/v1beta1
kind: MachineSet kind: MachineSet
metadata: metadata:
name: windows name: cluster-<id>-windows-ap-southeast-<zone>
namespace: openshift-machine-api namespace: openshift-machine-api
labels:
machine.openshift.io/cluster-api-cluster: cluster-<id>
spec: spec:
replicas: 1 replicas: 1
selector: selector:
matchLabels: matchLabels:
machine.openshift.io/cluster-api-cluster: demo machine.openshift.io/cluster-api-cluster: cluster-<id>
machine.openshift.io/cluster-api-machineset: windows machine.openshift.io/cluster-api-machineset: cluster-<id>-worker-ap-southeast-<zone>
template: template:
metadata: metadata:
labels: labels:
machine.openshift.io/cluster-api-cluster: demo machine.openshift.io/cluster-api-cluster: cluster-<id>
machine.openshift.io/cluster-api-machine-role: worker machine.openshift.io/cluster-api-machine-role: worker
machine.openshift.io/cluster-api-machine-type: worker machine.openshift.io/cluster-api-machine-type: worker
machine.openshift.io/cluster-api-machineset: windows machine.openshift.io/cluster-api-machineset: cluster-<id>-worker-ap-southeast-<zone>
machine.openshift.io/os-id: Windows machine.openshift.io/os-id: Windows
spec: spec:
lifecycleHooks: {} lifecycleHooks: {}
@ -60,7 +62,7 @@ spec:
userDataSecret: userDataSecret:
name: windows-user-data name: windows-user-data
placement: placement:
availabilityZone: ap-southeast-1c availabilityZone: ap-southeast-<zone>
region: ap-southeast-1 region: ap-southeast-1
credentialsSecret: credentialsSecret:
name: aws-cloud-credentials name: aws-cloud-credentials
@ -90,24 +92,23 @@ spec:
filters: filters:
- name: 'tag:Name' - name: 'tag:Name'
values: values:
- cluster-<id>-private-ap-southeast-1c - cluster-<id>-private-ap-southeast-<zone>
apiVersion: awsproviderconfig.openshift.io/v1beta1 apiVersion: awsproviderconfig.openshift.io/v1beta1
iamInstanceProfile: iamInstanceProfile:
id: cluster-<id>-worker-profile id: cluster-<id>-worker-profile
``` ```
There are four references to `<id>` in the sample that we need to replace with the actual cluster id for the cluster we have been allocated for the workshop. There are ten references to `<id>` in the sample that we need to find & replace with the actual cluster id for the cluster we have been allocated for the workshop and five references to the availability `<zone>` for our cluster nodes that we also need to update with our actual zone in use.
Run the following command in your bastion host to find your cluster id: Run the following command in your bastion host to find your cluster id and zone:
```bash ```bash
name=$(oc get machineset -n openshift-machine-api cluster-nkpgx-zf758-worker-ap-southeast-1c -o jsonpath={.metadata.name}) name=$(oc get machineset -A -o jsonpath={.items[0].metadata.name})
echo "Cluster id is: ${name:8:11}"
echo ${name:8:11} echo "Cluster availability zone is: ${name:40:2}"
``` ```
After retrieving your cluster id which will look something like example `nkpgx-zf758` update the sample `MachineSet` using your preferred text editor, then select and copy all of the text to clipboard. After retrieving your cluster id and zone update the sample `MachineSet` using your preferred text editor, then select and copy all of the text to clipboard.
Within OpenShift you can then click the button in the top right hand corner, paste in your yaml and click **Create**. Within OpenShift you can then click the button in the top right hand corner, paste in your yaml and click **Create**.