Kubernetes Ingress Setup for Oracle `sqlplus` TCP Connections

Kubernetes Ingress was online, services healthy, yet sqlplus refused to handshake. This is the gap many developers hit when mixing Oracle’s CLI with cloud-native networking.

Understanding the Problem

Kubernetes Ingress routes HTTP and HTTPS traffic into your cluster. sqlplus speaks Oracle’s custom protocol over TCP. By default, Ingress controllers—like NGINX or Traefik—aren’t designed for opaque TCP streams. If you try a simple Ingress manifest for Oracle, it won’t work. You need a TCP passthrough.

Direct TCP Ingress Setup

For Oracle Database inside Kubernetes, expose it via a Service of type ClusterIP or NodePort. Then configure your Ingress controller for TCP routing:

  1. Check if your Ingress supports TCP services. NGINX has a tcp-services-configmap.
  2. Map your database port (e.g., 1521) in that config.
  3. Redeploy the Ingress controller with the annotation or flag for TCP load balancing.
  4. Test with sqlplus using the cluster’s external IP and mapped port.

Example for NGINX:

# tcp-services-configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
 name: tcp-services
 namespace: ingress-nginx
data:
 "1521": "default/oracle-service:1521"

Apply this, restart the Ingress pod, and open security groups or firewall rules for the port. Now sqlplus user/password@external-ip:1521/service_name should connect.

Security Considerations

Do not expose the Oracle port to the public without TLS or network ACLs. Kubernetes Secrets should store credentials, and RBAC should lock down configs. Consider terminating TLS at an Ingress capable of proxying raw TCP.

Troubleshooting

  • If connection fails, check Ingress logs for denied TCP mappings.
  • Ensure Oracle container listens on all interfaces (LISTENER config updated).
  • Test inside the cluster first (kubectl exec into a pod and run sqlplus) before going external.

Conclusion

Setting up Kubernetes Ingress for sqlplus requires TCP routing beyond standard HTTP rules. Once configured, Oracle integration becomes seamless with cloud deployments.

See it live in minutes—visit hoop.dev and run your Kubernetes Ingress for sqlplus without touching bare metal.