|
| 1 | +// Module included in the following assemblies: |
| 2 | +// |
| 3 | +// * networking/network_security/ebpf_manager/ebpf-manager-operator-deploy.adoc |
| 4 | + |
| 5 | +:_mod-docs-content-type: PROCEDURE |
| 6 | +[id="nw-bpfman-operator-deploy_{context}"] |
| 7 | += Deploying a containerized eBPF program |
| 8 | + |
| 9 | +As a cluster administrator, you can deploy an eBPF program to nodes on your cluster. In this procedure, a sample containerized eBPF program is installed in the `go-xdp-counter` namespace. |
| 10 | + |
| 11 | +.Prerequisites |
| 12 | + |
| 13 | +* You have installed the OpenShift CLI (`oc`). |
| 14 | +* You have an account with administrator privileges. |
| 15 | +* You have installed the eBPF manager Operator. |
| 16 | +
|
| 17 | +.Procedure |
| 18 | + |
| 19 | +. To download the manifest, enter the following command: |
| 20 | ++ |
| 21 | +[source,terminal] |
| 22 | +---- |
| 23 | +$ curl -L https://github.com/bpfman/bpfman/releases/download/v0.5.1/go-xdp-counter-install-selinux.yaml -o go-xdp-counter-install-selinux.yaml |
| 24 | +---- |
| 25 | + |
| 26 | +. To deploy the sample eBPF application, enter the following command: |
| 27 | ++ |
| 28 | +[source,terminal] |
| 29 | +---- |
| 30 | +$ oc create -f go-xdp-counter-install-selinux.yaml |
| 31 | +---- |
| 32 | ++ |
| 33 | +.Example output |
| 34 | +[source,text] |
| 35 | +---- |
| 36 | +namespace/go-xdp-counter created |
| 37 | +serviceaccount/bpfman-app-go-xdp-counter created |
| 38 | +clusterrolebinding.rbac.authorization.k8s.io/xdp-binding created |
| 39 | +daemonset.apps/go-xdp-counter-ds created |
| 40 | +xdpprogram.bpfman.io/go-xdp-counter-example created |
| 41 | +selinuxprofile.security-profiles-operator.x-k8s.io/bpfman-secure created |
| 42 | +---- |
| 43 | + |
| 44 | +. To confirm that the eBPF sample application deployed successfully, enter the following command: |
| 45 | ++ |
| 46 | +[source,terminal] |
| 47 | +---- |
| 48 | +$ oc get all -o wide -n go-xdp-counter |
| 49 | +---- |
| 50 | ++ |
| 51 | +.Example output |
| 52 | +[source,text] |
| 53 | +---- |
| 54 | +NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES |
| 55 | +pod/go-xdp-counter-ds-4m9cw 1/1 Running 0 44s 10.129.0.92 ci-ln-dcbq7d2-72292-ztrkp-master-1 <none> <none> |
| 56 | +pod/go-xdp-counter-ds-7hzww 1/1 Running 0 44s 10.130.0.86 ci-ln-dcbq7d2-72292-ztrkp-master-2 <none> <none> |
| 57 | +pod/go-xdp-counter-ds-qm9zx 1/1 Running 0 44s 10.128.0.101 ci-ln-dcbq7d2-72292-ztrkp-master-0 <none> <none> |
| 58 | +
|
| 59 | +NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE SELECTOR AGE CONTAINERS IMAGES SELECTOR |
| 60 | +daemonset.apps/go-xdp-counter-ds 3 3 3 3 3 <none> 44s go-xdp-counter quay.io/bpfman-userspace/go-xdp-counter:v0.5.0 name=go-xdp-counter |
| 61 | +---- |
| 62 | + |
| 63 | +. To confirm that the example XDP program is running, enter the following command: |
| 64 | ++ |
| 65 | +[source,terminal] |
| 66 | +---- |
| 67 | +$ oc get xdpprogram go-xdp-counter-example |
| 68 | +---- |
| 69 | ++ |
| 70 | +.Example output |
| 71 | +[source,text] |
| 72 | +---- |
| 73 | +
|
| 74 | +NAME BPFFUNCTIONNAME NODESELECTOR STATUS |
| 75 | +go-xdp-counter-example xdp_stats {} ReconcileSuccess |
| 76 | +---- |
| 77 | + |
| 78 | +. To confirm that the XDP program is collecting data, enter the following command: |
| 79 | ++ |
| 80 | +[source,terminal] |
| 81 | +---- |
| 82 | +$ oc logs <pod_name> -n go-xdp-counter |
| 83 | +---- |
| 84 | ++ |
| 85 | +Replace `<pod_name>` with the name of a XDP program pod, such as `go-xdp-counter-ds-4m9cw`. |
| 86 | ++ |
| 87 | +.Example output |
| 88 | +[source,text] |
| 89 | +---- |
| 90 | +2024/08/13 15:20:06 15016 packets received |
| 91 | +2024/08/13 15:20:06 93581579 bytes received |
| 92 | + |
| 93 | +2024/08/13 15:20:09 19284 packets received |
| 94 | +2024/08/13 15:20:09 99638680 bytes received |
| 95 | + |
| 96 | +2024/08/13 15:20:12 23522 packets received |
| 97 | +2024/08/13 15:20:12 105666062 bytes received |
| 98 | + |
| 99 | +2024/08/13 15:20:15 27276 packets received |
| 100 | +2024/08/13 15:20:15 112028608 bytes received |
| 101 | + |
| 102 | +2024/08/13 15:20:18 29470 packets received |
| 103 | +2024/08/13 15:20:18 112732299 bytes received |
| 104 | + |
| 105 | +2024/08/13 15:20:21 32588 packets received |
| 106 | +2024/08/13 15:20:21 113813781 bytes received |
| 107 | +---- |
0 commit comments