Enabling Windows container workloads

    • You have access to an OKD cluster using an account with permissions.

    • You have installed the OpenShift CLI (oc).

    • You have installed your cluster using installer-provisioned infrastructure. Clusters installed with user-provisioned infrastructure are not supported for Windows container workloads.

    • You have configured hybrid networking with OVN-Kubernetes for your cluster. This must be completed during the installation of your cluster. For more information, see Configuring hybrid networking.

    • You are running an OKD cluster version 4.6.8 or later.

    Additional resources

    • For the comprehensive prerequisites for the Windows Machine Config Operator, see .

    You can install the Windows Machine Config Operator using either the web console or OpenShift CLI (oc).

    You can use the OKD web console to install the Windows Machine Config Operator (WMCO).

    Procedure

    1. From the Administrator perspective in the OKD web console, navigate to the Operators → OperatorHub page.

    2. Use the Filter by keyword box to search for Windows Machine Config Operator in the catalog. Click the Windows Machine Config Operator tile.

    3. Review the information about the Operator and click Install.

    4. On the Install Operator page:

      1. Select the stable channel as the Update Channel. The stable channel enables the latest stable release of the WMCO to be installed.

      2. The Installation Mode is preconfigured because the WMCO must be available in a single namespace only.

      3. Click the Enable Operator recommended cluster monitoring on the Namespace checkbox to enable cluster monitoring for the WMCO.

      4. Select an Approval Strategy.

        • The Automatic strategy allows Operator Lifecycle Manager (OLM) to automatically update the Operator when a new version is available.

    1. Click Install. The WMCO is now listed on the Installed Operators page.

    2. Verify that the Status shows Succeeded to confirm successful installation of the WMCO.

    Installing the Windows Machine Config Operator using the CLI

    You can use the OpenShift CLI (oc) to install the Windows Machine Config Operator (WMCO).

    Procedure

    1. Create a namespace for the WMCO.

      1. Create a Namespace object YAML file for the WMCO. For example, wmco-namespace.yaml:

      2. Create the namespace:

        1. $ oc create -f <file-name>.yaml

        For example:

        1. $ oc create -f wmco-namespace.yaml
    2. Create the Operator group for the WMCO.

      1. Create an OperatorGroup object YAML file. For example, wmco-og.yaml:

        1. apiVersion: operators.coreos.com/v1
        2. kind: OperatorGroup
        3. metadata:
        4. namespace: openshift-windows-machine-config-operator
        5. spec:
        6. targetNamespaces:
        7. - openshift-windows-machine-config-operator
      2. For example:

        1. $ oc create -f wmco-og.yaml
    3. Subscribe the namespace to the WMCO.

      1. Create a Subscription object YAML file. For example, wmco-sub.yaml:

        1. apiVersion: operators.coreos.com/v1alpha1
        2. metadata:
        3. name: windows-machine-config-operator
        4. namespace: openshift-windows-machine-config-operator
        5. spec:
        6. channel: "stable" (1)
        7. installPlanApproval: "Automatic" (2)
        8. name: "windows-machine-config-operator"
        9. sourceNamespace: "openshift-marketplace" (4)
      2. Create the subscription:

        1. $ oc create -f <file-name>.yaml

        For example:

        The WMCO is now installed to the openshift-windows-machine-config-operator.

    4. Verify the WMCO installation:

      1. $ oc get csv -n openshift-windows-machine-config-operator

      Example output

      1. NAME DISPLAY VERSION REPLACES PHASE
      2. windows-machine-config-operator.2.0.0 Windows Machine Config Operator 2.0.0 Succeeded

    To run the Windows Machine Config Operator (WMCO), you must create a secret in the WMCO namespace containing a private key. This is required to allow the WMCO to communicate with the Windows virtual machine (VM).

    Prerequisites

    • You installed the Windows Machine Config Operator (WMCO) using Operator Lifecycle Manager (OLM).

    • You created a PEM-encoded file containing an RSA key.

    Procedure

    • Define the secret required to access the Windows VMs:

      1. $ oc create secret generic cloud-private-key --from-file=private-key.pem=${HOME}/.ssh/<key> \
      2. -n openshift-windows-machine-config-operator (1)

    It is recommended to use a different private key than the one used when installing the cluster.

    • .