BTP Kyma Part 2: Deploying and Exposing a Service
Lessons are open to try during our launch period. Some advanced content may move to Pro later. AI practice limits apply separately.
Deploy a containerized service to Kyma end to end: build and push an image, create deployment and service manifests with resources and probes, bind BTP services via the operator, and expose the service externally with an APIRule — then verify and troubleshoot.
In this lessonShow sectionsHide sections
Visual overview
The situation: a real project scenario
An integration team built a custom service in Kyma; pods kept restarting. kubectl describe showed failing liveness probes on a wrong path. Correcting the probe path stabilized the service.
Explanation
Part 1 introduced Kyma; this part covers actually deploying and exposing a service on it. The first step is building a container image and pushing it to a registry Kyma can pull it from.
A Deployment then defines how many replicas to run, which image to use, environment variables, resource limits, and probes, while a Service gives that Deployment a stable internal address other things inside the cluster can reach. BTP services are bound in through ServiceBinding secrets, which get mounted into the pod as environment variables or files.
To expose the service externally, an APIRule defines the host, the target service, and the access rules governing who can reach it.
One easy thing to miss is readiness probes: without them, traffic can be routed to a pod before it's actually ready to handle it, leading to failed requests right after a deployment.
When something isn't working, kubectl describe pod is usually the fastest way to see image-pull failures and probe failures clearly, so it's a good first command to reach for. It's also worth being deliberate about authentication on an APIRule — exposing a service with no authentication configured on it makes that service public to anyone who finds the URL.
A reasonable sequence is to push an image, apply the Deployment and Service, and then create an APIRule and call the resulting URL. The checkpoint is that an authenticated call to that URL actually returns data.
Expert visual walkthrough
Deploying on Kyma
Kyma Runtime · Chapter-specific technical teaching map
Integration path
Container image
Kubernetes resources
Service / ingress
Test endpoint
Tutor's chapter takeaway
Deploy a containerized service to Kyma end to end: build and push an image, create deployment and service manifests with resources and probes, bind BTP services via the operator, and expose the service externally with an APIRule — then verify and troubleshoot.
In a real project
An integration team built a custom service in Kyma; pods kept restarting. kubectl describe showed failing liveness probes on a wrong path. Correcting the probe path stabilized the service.
Watch out for
• No probes or wrong paths. • No resource limits. • Public APIRules. • Secrets in images. • Latest tags.
Code example
===== deployment.yaml (excerpt) =====spec: replicas: 2 # runs 2 pod copies so the service stays up while one is restarting or being updated template: spec: containers: - name: orders image: registry.example.com/orders:1.0.0 resources: { limits: { memory: 256Mi, cpu: 250m } } # caps what this pod can consume so it can't starve other workloads on the node readinessProbe: { httpGet: { path: /health, port: 8080 } } # Kubernetes only routes traffic to the pod once this check passes envFrom: [ { secretRef: { name: orders-xsuaa-binding } } ] # injects the XSUAA service-binding credentials as env vars instead of hardcoding them ===== CHECKS =====kubectl get pods,svc,apirules -n orders # confirms the pod, its Service and the exposing APIRule all exist in this namespacekubectl describe pod <pod> -n orders | kubectl logs <pod> -n orders # describe shows scheduling/probe/image-pull events; logs shows what the app itself printedWatch out
Common mistakes
- No probes or wrong paths.
- No resource limits.
- Public APIRules.
- Secrets in images.
- Latest tags.
Do this
Best practices
- Proper probes.
- Set limits.
- Authenticated APIRules.
- Bindings for secrets.
- Versioned images.
In the interview
Interview angle
Questions: "How do you deploy to Kyma?", "What is an APIRule?", "How do you troubleshoot a failing pod?"
Strong answer: image, deployment/service, bindings, exposure, troubleshooting.
Practice this lesson
Quick check
0 of 3 questions attempted
Question 1 of 3
Pods keep restarting after deployment. What should you check first?
Question 2 of 3
How do Kyma workloads typically get credentials for BTP services?
Question 3 of 3
Candidates are frequently asked how they would securely expose a microservice on Kyma to external callers. In the Kyma Runtime context, which answer shows the strongest practical judgment?
Practise this in an interview
Answer in your own words and get instant feedback, the way an interviewer would judge it.
1How would you apply Kyma Runtime in a real SAP project? Walk through the design or implementation approach.
2What are the most important design decisions, trade-offs, and best practices in Kyma Runtime?
See it in code
Each example starts from a requirement, shows the design, then the code step by step with a plain-language explanation of every part.
Was this lesson helpful?
Keep exploring
Interview questions on this topic
Check before use: lesson examples are educational, not a guarantee of correctness for your SAP edition or release. Sample code has not been executed on your SAP system. Confirm API availability, syntax, authorizations and business impact in an approved development or test environment.