$ cat << EOF | oc apply -f -
apiVersion: v1
kind: Namespace
metadata:
name: openshift-nmstate
spec:
finalizers:
- kubernetes
EOF
The Kubernetes NMState Operator provides a Kubernetes API for performing state-driven network configuration across the OKD cluster’s nodes with NMState. The Kubernetes NMState Operator provides users with functionality to configure various network interface types, DNS, and routing on cluster nodes. Additionally, the daemons on the cluster nodes periodically report on the state of each node’s network interfaces to the API server.
Red Hat supports the Kubernetes NMState Operator in production environments on bare-metal, IBM Power®, IBM Z®, IBM® LinuxONE, VMware vSphere, and OpenStack installations. |
Before you can use NMState with OKD, you must install the Kubernetes NMState Operator.
The Kubernetes NMState Operator updates the network configuration of a secondary NIC. The Operator cannot update the network configuration of the primary NIC, or update the On a bare-metal platform, using the Kubernetes NMState Operator to update the |
OKD uses nmstate
to report on and configure the state of the node network. This makes it possible to modify the network policy configuration, such as by creating a Linux bridge on all nodes, by applying a single configuration manifest to the cluster.
Node networking is monitored and updated by the following objects:
NodeNetworkState
Reports the state of the network on that node.
NodeNetworkConfigurationPolicy
Describes the requested network configuration on nodes. You update the node network configuration, including adding and removing interfaces, by applying a NodeNetworkConfigurationPolicy
CR to the cluster.
NodeNetworkConfigurationEnactment
Reports the network policies enacted upon each node.
You can install the Kubernetes NMState Operator by using the web console or the CLI.
You can install the Kubernetes NMState Operator by using the web console. After it is installed, the Operator can deploy the NMState State Controller as a daemon set across all of the cluster nodes.
You are logged in as a user with cluster-admin
privileges.
Select Operators → OperatorHub.
In the search field below All Items, enter nmstate
and click Enter to search for the Kubernetes NMState Operator.
Click on the Kubernetes NMState Operator search result.
Click on Install to open the Install Operator window.
Click Install to install the Operator.
After the Operator finishes installing, click View Operator.
Under Provided APIs, click Create Instance to open the dialog box for creating an instance of kubernetes-nmstate
.
In the Name field of the dialog box, ensure the name of the instance is nmstate.
The name restriction is a known issue. The instance is a singleton for the entire cluster. |
Accept the default settings and click Create to create the instance.
Once complete, the Operator has deployed the NMState State Controller as a daemon set across all of the cluster nodes.
You can install the Kubernetes NMState Operator by using the OpenShift CLI (oc)
. After it is installed, the Operator can deploy the NMState State Controller as a daemon set across all of the cluster nodes.
You have installed the OpenShift CLI (oc
).
You are logged in as a user with cluster-admin
privileges.
Create the nmstate
Operator namespace:
$ cat << EOF | oc apply -f -
apiVersion: v1
kind: Namespace
metadata:
name: openshift-nmstate
spec:
finalizers:
- kubernetes
EOF
Create the OperatorGroup
:
$ cat << EOF | oc apply -f -
apiVersion: operators.coreos.com/v1
kind: OperatorGroup
metadata:
name: openshift-nmstate
namespace: openshift-nmstate
spec:
targetNamespaces:
- openshift-nmstate
EOF
Subscribe to the nmstate
Operator:
$ cat << EOF| oc apply -f -
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
name: kubernetes-nmstate-operator
namespace: openshift-nmstate
spec:
channel: stable
installPlanApproval: Automatic
name: kubernetes-nmstate-operator
source: redhat-operators
sourceNamespace: openshift-marketplace
EOF
Confirm the ClusterServiceVersion
(CSV) status for the nmstate
Operator deployment equals Succeeded
:
$ oc get clusterserviceversion -n openshift-nmstate \
-o custom-columns=Name:.metadata.name,Phase:.status.phase
Name Phase
kubernetes-nmstate-operator.4.16.0-202210210157 Succeeded
Create an instance of the nmstate
Operator:
$ cat << EOF | oc apply -f -
apiVersion: nmstate.io/v1
kind: NMState
metadata:
name: nmstate
EOF
Verify the pods for NMState Operator are running:
$ oc get pod -n openshift-nmstate
Name Ready Status Restarts Age
pod/nmstate-cert-manager-5b47d8dddf-5wnb5 1/1 Running 0 77s
pod/nmstate-console-plugin-d6b76c6b9-4dcwm 1/1 Running 0 77s
pod/nmstate-handler-6v7rm 1/1 Running 0 77s
pod/nmstate-handler-bjcxw 1/1 Running 0 77s
pod/nmstate-handler-fv6m2 1/1 Running 0 77s
pod/nmstate-handler-kb8j6 1/1 Running 0 77s
pod/nmstate-handler-wn55p 1/1 Running 0 77s
pod/nmstate-operator-f6bb869b6-v5m92 1/1 Running 0 4m51s
pod/nmstate-webhook-66d6bbd84b-6n674 1/1 Running 0 77s
pod/nmstate-webhook-66d6bbd84b-vlzrd 1/1 Running 0 77s