1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-05 12:46:18 +01:00
Files
openshift-docs/modules/k8s-nmstate-deploying-nmstate-CLI.adoc

125 lines
3.1 KiB
Plaintext

// This is included in the following assemblies:
//
// networking/k8s_nmstate/k8s-nmstate-about-the-kubernetes-nmstate-operator.adoc
:_mod-docs-content-type: PROCEDURE
[id="installing-the-kubernetes-nmstate-operator-CLI_{context}"]
= Installing the Kubernetes NMState Operator by using the CLI
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.
.Prerequisites
* You have installed the OpenShift CLI (`oc`).
* You are logged in as a user with `cluster-admin` privileges.
.Procedure
. Create the `nmstate` Operator namespace:
+
[source,terminal]
----
$ cat << EOF | oc apply -f -
apiVersion: v1
kind: Namespace
metadata:
name: openshift-nmstate
spec:
finalizers:
- kubernetes
EOF
----
. Create the `OperatorGroup`:
+
[source,terminal]
----
$ 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:
+
[source,terminal]
----
$ 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`:
+
[source,terminal,subs="attributes+"]
----
$ oc get clusterserviceversion -n openshift-nmstate \
-o custom-columns=Name:.metadata.name,Phase:.status.phase
----
. Create an instance of the `nmstate` Operator:
+
[source,terminal]
----
$ cat << EOF | oc apply -f -
apiVersion: nmstate.io/v1
kind: NMState
metadata:
name: nmstate
EOF
----
. If your cluster has problems with the DNS health check probe because of DNS connectivity issues, you can add the following DNS host name configuration to the `NMState` CRD to build in health checks that can resolve these issues:
+
[source,terminal]
----
apiVersion: nmstate.io/v1
kind: NMState
metadata:
name: nmstate
spec:
probeConfiguration:
dns:
host: redhat.com
# ...
----
+
.. Apply the DNS host name configuration to your cluster network by running the following command. Ensure that you replace `<filename>` with the name of your CRD file.
+
[source,yaml]
----
$ oc apply -f <filename>.yaml
----
+
.. Monitor the `nmstate` CRD until the resource reaches the `Available` condition by running the following command. Ensure that you set a value for the `--timeout` option so that if the `Available` condition is not met within this set maximum waiting time, the command times out and generates an error message.
+
[source,yaml]
----
$ oc wait --for=condition=Available nmstate/nmstate --timeout=600s
----
.Verification
. Verify that all pods for the NMState Operator have the `Running` status by entering the following command:
+
[source,terminal]
----
$ oc get pod -n openshift-nmstate
----