If you create a Function in a namespace with enabled Istio sidecar injection, an Istio sidecar proxy is automatically injected to the Function’s Pod during its creation. This makes the Function part of the Istio service mesh. To expose a workload using an APIRule custom resource, it is required to include the workload in the Istio service mesh.
In your terminal, go to your working folder, and run:
bash/Powershell
Copy
kyma function init
If successful, you get the following message: Functions files of runtime nodejs22 initialized to dir {WORKING_FOLDER_PATH}
You have created 2 files in your working folder:
handler.js
package.json
You can check the content of the files with your editor (e.g. Visual Studio Code).
To apply your Function to your Kyma runtime, run:
bash/Powershell
Copy
kyma function create hello-function
If successful, you get the following message:
bash/Powershell
Copy
resource default/hello-function applied
To verify the Function deployment, run:
bash/Powershell
Copy
kyma function get hello-function
If successful, you get the following result:
bash/Powershell
Copy
NAME CONFIGURED BUILT RUNNING RUNTIME GENERATION
hello-function True True True nodejs22 1
Step 3
In your working folder, create a new YAML file named myapirule.yaml. You can do this using a text editor or by running touch myapirule.yaml in your terminal.
Open the file in your editor and add the following APIRule definition: