<commit_before>// Module included in the following assemblies:
//
// * networking/configuring-ipfailover.adoc

[id="nw-ipfailover-configuration_{context}"]
= Configuring IP failover

As a cluster administrator, you can configure IP failover on an entire cluster, or on a subset of nodes, as defined by the label selector. You can also configure multiple IP failover deployment configurations in your cluster, where each one is independent of the others.

The IP failover deployment configuration ensures that a failover pod runs on each of the nodes matching the constraints or the label used.

This pod runs Keepalived, which can monitor an endpoint and use Virtual Router Redundancy Protocol (VRRP) to fail over the virtual IP (VIP) from one node to another if the first node cannot reach the service or endpoint.

For production use, set a `selector` that selects at least two nodes, and set `replicas` equal to the number of selected nodes.

.Prerequisites

* You are logged in to the cluster with a user with `cluster-admin` privileges.
* You created a pull secret.

.Procedure

//. Create an {product-title} pull secret
//+
. Create an IP failover service account:
+
[source,terminal]
----
$ oc create sa ipfailover
----
+
. Update security context constraints (SCC) for `hostNetwork`:
+
[source,terminal]
----
$ oc adm policy add-scc-to-user privileged -z ipfailover
$ oc adm policy add-scc-to-user hostnetwork -z ipfailover
----
+
. Create a deployment YAML file to configure IP failover:
+
.Example deployment YAML for IP failover configuration
[source,yaml]
----
apiVersion: apps/v1
kind: Deployment
metadata:
  name: ipfailover-keepalived <1>
  labels:
    ipfailover: hello-openshift
spec:
  strategy:
    type: Recreate
  replicas: 2
  selector:
    matchLabels:
      ipfailover: hello-openshift
  triggers:
    type: ConfigChange
  template:
    metadata:
      labels:
        ipfailover: hello-openshift
    spec:
      serviceAccountName: ipfailover
      privileged: true
      hostNetwork: true
      nodeSelector:
        node-role.kubernetes.io/worker: ""
      containers:
      - name: openshift-ipfailover
        image: quay.io/openshift/ose-keepalived-ipfailover:latest
        ports:
        - containerPort: 63000
          hostPort: 63000
        imagePullPolicy: IfNotPresent
        securityContext:
          privileged: true
        volumeMounts:<commit_msg>OSDOCS-2176 follow-up to remove triggers from the deployment YAML<commit_after>// Module included in the following assemblies:
//
// * networking/configuring-ipfailover.adoc

[id="nw-ipfailover-configuration_{context}"]
= Configuring IP failover

As a cluster administrator, you can configure IP failover on an entire cluster, or on a subset of nodes, as defined by the label selector. You can also configure multiple IP failover deployment configurations in your cluster, where each one is independent of the others.

The IP failover deployment configuration ensures that a failover pod runs on each of the nodes matching the constraints or the label used.

This pod runs Keepalived, which can monitor an endpoint and use Virtual Router Redundancy Protocol (VRRP) to fail over the virtual IP (VIP) from one node to another if the first node cannot reach the service or endpoint.

For production use, set a `selector` that selects at least two nodes, and set `replicas` equal to the number of selected nodes.

.Prerequisites

* You are logged in to the cluster with a user with `cluster-admin` privileges.
* You created a pull secret.

.Procedure

//. Create an {product-title} pull secret
//+
. Create an IP failover service account:
+
[source,terminal]
----
$ oc create sa ipfailover
----
+
. Update security context constraints (SCC) for `hostNetwork`:
+
[source,terminal]
----
$ oc adm policy add-scc-to-user privileged -z ipfailover
$ oc adm policy add-scc-to-user hostnetwork -z ipfailover
----
+
. Create a deployment YAML file to configure IP failover:
+
.Example deployment YAML for IP failover configuration
[source,yaml]
----
apiVersion: apps/v1
kind: Deployment
metadata:
  name: ipfailover-keepalived <1>
  labels:
    ipfailover: hello-openshift
spec:
  strategy:
    type: Recreate
  replicas: 2
  selector:
    matchLabels:
      ipfailover: hello-openshift
  template:
    metadata:
      labels:
        ipfailover: hello-openshift
    spec:
      serviceAccountName: ipfailover
      privileged: true
      hostNetwork: true
      nodeSelector:
        node-role.kubernetes.io/worker: ""
      containers:
      - name: openshift-ipfailover
        image: quay.io/openshift/ose-keepalived-ipfailover:latest
        ports:
        - containerPort: 63000
          hostPort: 63000
        imagePullPolicy: IfNotPresent
        securityContext:
          privileged: true
        volumeMounts:
{'fraction_non_alphanumeric': 0.07290147885857114, 'fraction_numerical': 0.006248698187877526, 'mean_word_length': 3.3575317604355717, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6947144', 'n_tokens_mistral': 1390, 'n_tokens_neox': 1327, 'n_words': 544}