copyright | lastupdated | keywords | subcollection | ||
---|---|---|---|---|---|
|
2020-04-14 |
kubernetes, iks, nginx, ingress controller |
containers |
{:codeblock: .codeblock} {:deprecated: .deprecated} {:download: .download} {:external: target="_blank" .external} {:faq: data-hd-content-type='faq'} {:gif: data-image-type='gif'} {:help: data-hd-content-type='help'} {:important: .important} {:new_window: target="_blank"} {:note: .note} {:pre: .pre} {:preview: .preview} {:screen: .screen} {:shortdesc: .shortdesc} {:support: data-reuse='support'} {:table: .aria-labeledby="caption"} {:tip: .tip} {:troubleshoot: data-hd-content-type='troubleshoot'} {:tsCauses: .tsCauses} {:tsResolve: .tsResolve} {:tsSymptoms: .tsSymptoms}
{: #ingress-qs} {: help} {: support}
Quickly expose your app to the Internet by creating an Ingress resource. {: shortdesc}
First time setting up Ingress? Check out Setting up Ingress for prerequisite steps and more details. Come back to these quick start steps for a brief refresher the next time you set up an Ingress resource. {: tip}
- Create a Kubernetes ClusterIP service for your app so that it can be included in the Ingress application load balancing.
kubectl expose deploy <app_deployment_name> --name my-app-svc --port <app_port> -n <namespace>
{: pre}
-
Get the Ingress subdomain and secret for your cluster.
ibmcloud ks cluster get -c <cluster_name_or_ID> | grep Ingress
{: pre} Example output:
Ingress Subdomain: mycluster-a1b2cdef345678g9hi012j3kl4567890-0000.us-south.containers.appdomain.cloud Ingress Secret: mycluster-a1b2cdef345678g9hi012j3kl4567890-0000
{: screen}
-
Using the Ingress subdomain and secret, 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/v1beta1
kind: Ingress
metadata:
name: myingressresource
spec:
tls:
- hosts:
- <ingress_subdomain>
secretName: <ingress_secret>
rules:
- host: <ingress_subdomain>
http:
paths:
- path: /<app_path>
backend:
serviceName: my-app-svc
servicePort: 80
{: codeblock}
- Create the Ingress resource.
kubectl apply -f myingressresource.yaml
{: pre}
- In a web browser, enter the Ingress subdomain and the path for your app.
https://<ingress_subdomain>/<app_path>
{: codeblock}
For more information, see: