$ oc annotate namespace <namespace> \
k8s.ovn.org/multicast-enabled=true
The Open Virtual Networking (OVN) Kubernetes network plug-in is a Technology Preview feature only. Technology Preview features are not supported with Red Hat production service level agreements (SLAs) and might not be functionally complete. Red Hat does not recommend using them in production. These features provide early access to upcoming product features, enabling customers to test functionality and provide feedback during the development process. For more information about the support scope of the OVN Technology Preview, see https://access.redhat.com/articles/4380121. |
In OpenShift Container Platform 4.4, a bug prevents Pods in the same namespace, but assigned to different nodes, from communicating over multicast. For more information, see BZ#1843695. |
With IP multicast, data is broadcast to many IP addresses simultaneously.
At this time, multicast is best used for low-bandwidth coordination or service discovery and not a high-bandwidth solution. |
Multicast traffic between OpenShift Container Platform 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.
You can enable multicast between pods for your project.
Install the OpenShift CLI (oc
).
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.
$ oc annotate namespace <namespace> \
k8s.ovn.org/multicast-enabled=true
To verify that multicast is enabled for a project, complete the following procedure:
Change your current project to the project that you enabled multicast for. Replace <project>
with the project name.
$ oc project <project>
Create a pod to act as a multicast receiver:
$ cat <<EOF| oc create -f -
apiVersion: v1
kind: Pod
metadata:
name: mlistener
labels:
app: multicast-verify
spec:
containers:
- name: mlistener
image: registry.access.redhat.com/ubi8
command: ["/bin/sh", "-c"]
args:
["dnf -y install socat hostname && sleep inf"]
ports:
- containerPort: 30102
name: mlistener
protocol: UDP
EOF
Create a pod to act as a multicast sender:
$ cat <<EOF| oc create -f -
apiVersion: v1
kind: Pod
metadata:
name: msender
labels:
app: multicast-verify
spec:
containers:
- name: msender
image: registry.access.redhat.com/ubi8
command: ["/bin/sh", "-c"]
args:
["dnf -y install socat && sleep inf"]
EOF
Start the multicast listener.
Get the IP address for the Pod:
$ POD_IP=$(oc get pods mlistener -o jsonpath='{.status.podIP}')
To start the multicast listener, in a new terminal window or tab, enter the following command:
$ oc exec mlistener -i -t -- \
socat UDP4-RECVFROM:30102,ip-add-membership=224.1.0.1:$POD_IP,fork EXEC:hostname
Start the multicast transmitter.
Get the pod network IP address range:
$ CIDR=$(oc get Network.config.openshift.io cluster \
-o jsonpath='{.status.clusterNetwork[0].cidr}')
To send a multicast message, enter the following command:
$ oc exec msender -i -t -- \
/bin/bash -c "echo | socat STDIO UDP4-DATAGRAM:224.1.0.1:30102,range=$CIDR,ip-multicast-ttl=64"
If multicast is working, the previous command returns the following output:
mlistener