Get DNS

DNS names provide a standard way to make services accessible on the public internet. In Kubernetes applications, DNS names are most often used with Ingress objects to map incoming requests to an external Load Balancer to workloads running inside the cluster. In Humanitec, a DNS name is represented as a Resource of type dns. A TLS certificate is represented by a Resource of type tls-cert. By default, Humanitec will automatically generate dynamic DNS name under the .newapp.io domain along with a valid SSL certificate. However, it is possible to configure different DNS names that will get picked up in different environments.

  1. From the Application overview, select the name of the Application you’d like to get the DNS for.
  2. Under Active deployment, select the most recent and then choose View Workload.
  3. The route specified for each DNS of the Workload is specified under Ingres.

If the desired output is YAML, you can get the DNS name of a Workload by running the following command with yq:

humctl  get active-resources -c /orgs/${HUM_ORG}/apps/${APPLICATION_NAME}/envs/${ENVIRONMENT_ID} | yq -r '.[] | select(.object.type == "dns") | .object.resource.host'

If the desired output is JSON, you can get the DNS name of a Workload by running the following command with jq:

humctl  get active-resources -c /orgs/${HUM_ORG}/apps/${APPLICATION_NAME}/envs/${ENVIRONMENT_ID}  --output json | jq -r '.[] | select(.object.type == "dns") | .object.resource.host'

Where the following environment variables are set:

Variable Example Description
HUM_ORG my-org The name of your Humanitec organization.
APPLICATION_NAME my-app The name of your Humanitec application.
ENVIRONMENT_ID my-env The ID of your Humanitec environment.

The output will be similar to the following:

randomappname.newapp.io

For more information about implement Ingress in your Score file, see Implement ports and volumes.

Top