Enabling multicast for a project

    Multicast traffic between OKD pods is disabled by default. If you are using the OVN-Kubernetes default Container Network Interface (CNI) network provider, you can enable multicast on a per-project basis.

    Enabling multicast between pods

    You can enable multicast between pods for your project.

    Prerequisites

    • Install the OpenShift CLI ().

    • You must log in to the cluster with a user that has the cluster-admin role.

    • Run the following command to enable multicast for a project. Replace <namespace> with the namespace for the project you want to enable multicast for.

      You can alternatively apply the following YAML to add the annotation:

      1. apiVersion: v1
      2. kind: Namespace
      3. metadata:
      4. name: <namespace>
      5. annotations:
      6. k8s.ovn.org/multicast-enabled: true

    Verification

    To verify that multicast is enabled for a project, complete the following procedure:

    1. Change your current project to the project that you enabled multicast for. Replace <project> with the project name.

      1. $ cat <<EOF| oc create -f -
      2. apiVersion: v1
      3. kind: Pod
      4. metadata:
      5. name: msender
      6. labels:
      7. app: multicast-verify
      8. spec:
      9. containers:
      10. image: registry.access.redhat.com/ubi8
      11. command: ["/bin/sh", "-c"]
      12. ["dnf -y install socat && sleep inf"]
      13. EOF
    2. Start the multicast listener.

      1. Get the IP address for the Pod:

        1. $ POD_IP=$(oc get pods mlistener -o jsonpath='{.status.podIP}')
      2. To start the multicast listener, in a new terminal window or tab, enter the following command:

    3. Start the multicast transmitter.

      1. Get the pod network IP address range:

        1. $ CIDR=$(oc get Network.config.openshift.io cluster \
        2. -o jsonpath='{.status.clusterNetwork[0].cidr}')
      2. To send a multicast message, enter the following command:

        1. $ oc exec msender -i -t -- \