What is a Service?
In Kubernetes, pods have ephemeral IP addresses that change when pods restart. A Service provides:- A stable DNS name and IP address
- Load balancing across multiple pod replicas
- Network access control (internal vs. external)
Service Types
Orchard supports three types of services:Internal
Accessible only within the cluster
External
Publicly accessible via LoadBalancer
Ingress
HTTP(S) routing with custom domains
Internal (ClusterIP)
Internal services are only accessible from within the Kubernetes cluster. Use these for:- Databases that shouldn’t be public
- Internal APIs between microservices
- Backend services accessed by frontends
External (LoadBalancer)
External services are accessible from the internet via a public IP address. Use these for:- APIs that need direct external access
- Services without a custom domain
- Quick testing and development
External services get a public IP assigned by the cluster. For custom domains with HTTPS, use an Ingress instead.
Ingress
Ingresses provide HTTP(S) routing with custom domains, TLS certificates, and path-based routing. See Ingresses for details.Creating a Service
1
Open your deployment
Navigate to the deployment you want to expose.
2
Go to Networking tab
Click on the Networking tab.
3
Click 'Add Service'
Click Add Service to create a new service.
4
Configure the service
| Field | Description |
|---|---|
| Name | Unique name for the service |
| Type | Internal or External |
| Port | The port to expose |
| Target Port | The port your container listens on |
5
Create
Click Create to set up the service.
Port Configuration
Single Port Service
For most applications with one port:| Setting | Value |
|---|---|
| Container Port | 3000 (what your app listens on) |
| Service Port | 80 (what users connect to) |
Multiple Ports
Some applications need multiple ports (e.g., HTTP + gRPC):| Name | Container Port | Service Port | Protocol |
|---|---|---|---|
| http | 8080 | 80 | TCP |
| grpc | 9090 | 9090 | TCP |
| metrics | 9100 | 9100 | TCP |
Accessing Internal Services
To connect to an internal service from another deployment in the same project:From Environment Variables
Set the service URL as an environment variable:Updating Services
To modify an existing service:1
Open the Networking tab
Navigate to your deployment’s Networking tab.
2
Click on the service
Select the service you want to update.
3
Make changes
Modify the port configuration or other settings.
4
Save
Click Save to apply changes.
Changing Service Exposure
To change a service from internal to external (or vice versa):1
Open the service
Go to your deployment’s Networking tab and select the service.
2
Change exposure
Click the exposure toggle or button to switch between internal and external.
3
Save
Changes take effect immediately.
Changing from external to internal will remove the public IP. Changing to external will provision a new public IP (which may take a few minutes).
Deleting Services
To remove a service:1
Open the Networking tab
Go to your deployment’s Networking tab.
2
Find the service
Locate the service you want to delete.
3
Delete
Click the delete button and confirm.
Service Discovery
Within the Same Project
Services in the same project (namespace) can use short names:Across Projects
To access a service in a different project, use the full DNS name:Cross-project communication may be restricted by network policies. Check with your administrator.
Load Balancing
When you have multiple replicas, services automatically load balance traffic across all healthy pods:Health Checks
Services only route traffic to healthy pods. A pod is considered healthy when:- The container has started
- Any readiness probes pass
- The pod is not terminating
Best Practices
Use internal services by default
Use internal services by default
Start with internal services and only expose externally when needed. This follows the principle of least privilege.
Use meaningful names
Use meaningful names
Name services clearly (e.g.,
postgres, api-server, redis) so they’re easy to identify in configuration.Document service ports
Document service ports
Keep track of which services use which ports, especially in microservice architectures.
Use ingresses for HTTP traffic
Use ingresses for HTTP traffic
For web traffic with custom domains, use ingresses instead of external services to get HTTPS and better routing.
Troubleshooting
Service not accessible
Service not accessible
If you can’t reach your service:
- Verify the service exists in the Networking tab
- Check that pods are running and healthy
- Verify the port configuration matches your application
- For external services, check the public IP is assigned
Connection refused
Connection refused
If connections are refused:
- Verify your application is listening on the correct port
- Check that the container port matches what your app uses
- Look at pod logs for startup errors
Intermittent failures
Intermittent failures
If requests sometimes fail:
- Check pod health and restart counts
- Verify all replicas are healthy
- Look for resource limits being hit