IBM Cloud Docs
Quick start for Ingress

Quick start for Ingress

Quickly expose your app to the Internet by creating an Ingress resource.

Before you begin

Not sure whether to use Ingress or Routes? See Choosing among load balancing solutions.

Exposing your app with Ingress

  1. Create a Kubernetes ClusterIP service for your app deployment.

    oc expose deploy <app_deployment_name> --name my-app-svc --port <app_port> -n <project>
    
  2. Get the Ingress subdomain for your cluster.

    ibmcloud oc cluster get -c <cluster_name_or_ID> | grep 'Ingress Subdomain'
    

    Example output

    Ingress Subdomain:      mycluster-a1b2cdef345678g9hi012j3kl4567890-0000.us-south.containers.appdomain.cloud
    
  3. Using the Ingress subdomain, create an Ingress resource file. Replace <app_path> with the path that your app listens on. If your app does not listen on a specific path, define the root path as a slash (/) only.

    apiVersion: networking.k8s.io/v1
    kind: Ingress
    metadata:
      name: myingressresource
    spec:
      rules:
      - host: <ingress_subdomain>
        http:
          paths:
          - path: /<app_path>
            pathType: ImplementationSpecific
            backend:
              service:
                name: my-app-svc
                port:
                  number: 80
    
  4. Create the Ingress resource in the same project as your app service.

    oc apply -f myingressresource.yaml -n <project>
    
  5. In a web browser, enter the Ingress subdomain and the path for your app.

    http://<ingress_subdomain>/<app_path>