Ozone on Kubernetes
The Kubernetes examples and scripts in this project have been tested with Kubernetes 1.34.2 (k3s v1.34.2+k3s1).
Connecting IDE to Ozone on Kubernetes
Setup Ozone and Kubernetes
To start Ozone in Kubernetes, you need Kubernetes and kubectl installed. You also need to add the flekszible binary in your path.
- Build the project
mvn clean install -DskipShade -DskipTests cd <ozone-root>/hadoop-ozone/dist/target/ozone-X.X../kubernetes/examples/ozonesource ../testlib.shregenerate_resources
Configure IntelliJ
Select some preferred ports for attaching the debugger. Below there is an example configuration for connecting OM to port 5005, SCM to port 6006 and S3G to port 7007.
Run -> Edit Configurations... -> Add New Configuration -> Remote JVM Debug- Name:
om-0, Debugger mode:Attach to remote JVM, Host:localhost, Port:5005 - Name:
scm-0, Debugger mode:Attach to remote JVM, Host:localhost, Port:6006 - Name:
s3g-0, Debugger mode:Attach to remote JVM, Host:localhost, Port:7007
Update Ozone startup to use the preferred ports, as follows:
In the file <ozone-root>/hadoop-ozone/dist/target/ozone-X.X../bin/ozone
- Replace
OZONE_OM_OPTS="${RATIS_OPTS} ${OZONE_OM_OPTS}"withOZONE_OM_OPTS="${RATIS_OPTS} ${OZONE_OM_OPTS} -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005" - Replace
OZONE_SCM_OPTS="${RATIS_OPTS} ${OZONE_SCM_OPTS}"withOZONE_SCM_OPTS="${RATIS_OPTS} ${OZONE_SCM_OPTS} -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:6006" - In
ozone-s3gatewayaddOZONE_S3G_OPTS="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:7007"
Start Ozone in Kubernetes
-
Start the kubernetes server. For example, if using k3s,
sudo k3s server -
In a new terminal
cd <ozone-root>/hadoop-ozone/dist/target/ozone-X.X../kubernetes/examples/ozone -
kubectl apply -f . -
Check if the pods are running
kubectl get pods -
Start port-forwarding in the background
kubectl port-forward om-0 5005:5005 &
kubectl port-forward scm-0 6006:6006 &
kubectl port-forward s3g-0 7007:7007 &
Connect IntelliJ to Kubernetes cluster
-
Go over the code and set breakpoints for the parts you want to debug
-
Start in Debug mode the Remote JVM Debug configurations that we created earlier in IntelliJ
-
An example use would be to read and write objects in bash and check the output in the Debugger in IntelliJ. For example, set a breakpoint in the OMVolumeCreateRequest, then create a volume like so to hit it:
kubectl exec -it scm-0 bash
ozone sh volume create testVolume