In the process of migrating to Kubernetes, there is one service that is different from the others. This service is mainly used for data exchange and synchronization with the underlying SAP system. SAP provides a development library of SAP Java Connector (SAP JCo) to connect the SAP system.

Linux in a non-container environment

Jco is essentially an RFC-based ABAP and JAVA interprocess communication component. Different from other components, Jco does not introduce a Jar package to solve the problem. The package downloaded from the official website contains two files, Jar package and Native library:

  • libsapjco3.so
  • sapjco3.jar

The Native library must be loaded in the system environment variable to drive the Jar package

Echo "export LD_LIBRARY_PATH=/ Your directory ">> /etc/profile#To take effect
source /etc/profile
Copy the code

This allows the Java application to successfully connect to the SAP system once it runs.

Container environment

Due to the need to migrate to Kubernetes environment, the following three points need to be done after analysis:

  1. Define volume to mount the JCO folder as hostPath to Pod

    After uploading the JCO folder to the host, mount it

The Kuboard tool is used here for convenience, and the YAML resource files are not edited directly. If not professional Kubernetes operation and maintenance, in fact, personal advice to use some graphics management tools will be more efficient.

  1. Configure the environment variable LD_LIBRARY_PATH

  2. Since you don’t want to upload all machines to the JCO folder, consider limiting the application to two or three machines after labeling them

After the above three points are done, it starts, SAP connection is normal, and that’s it.