Version: v1.1

Ingress

The ingress trait exposes a component to public Internet via a valid domain.

Specification

  1. kubectl vela show ingress
  1. # Properties
  2. +--------+------------------------------------------------------------------------------+----------------+----------+---------+
  3. | NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
  4. +--------+------------------------------------------------------------------------------+----------------+----------+---------+
  5. | http | Specify the mapping relationship between the http path and the workload port | map[string]int | true | |
  6. | domain | Specify the domain you want to expose | string | true | |
  7. +--------+------------------------------------------------------------------------------+----------------+----------+---------+

How to use

Attach a ingress trait to the component you want to expose and deploy.

  1. # vela-app.yaml
  2. apiVersion: core.oam.dev/v1beta1
  3. kind: Application
  4. metadata:
  5. name: first-vela-app
  6. spec:
  7. components:
  8. - name: express-server
  9. type: webservice
  10. properties:
  11. image: crccheck/hello-world
  12. port: 8000
  13. traits:
  14. - type: ingress
  15. properties:
  16. domain: testsvc.example.com
  17. http:
  18. "/": 8000
  1. kubectl apply -f https://raw.githubusercontent.com/oam-dev/kubevela/master/docs/examples/vela-app.yaml
  1. application.core.oam.dev/first-vela-app created

Check the status until we see status is running and services are healthy:

  1. kubectl get application first-vela-app -w
  1. NAME COMPONENT TYPE PHASE HEALTHY STATUS AGE
  2. first-vela-app express-server webservice healthChecking 14s
  3. first-vela-app express-server webservice running true 42s

Check the trait detail for the its visiting url:

  1. kubectl get application first-vela-app -o yaml
  1. apiVersion: core.oam.dev/v1beta1
  2. kind: Application
  3. metadata:
  4. name: first-vela-app
  5. namespace: default
  6. spec:
  7. ...
  8. services:
  9. - healthy: true
  10. name: express-server
  11. traits:
  12. - healthy: true
  13. message: 'Visiting URL: testsvc.example.com, IP: <your ip address>'
  14. type: ingress
  15. status: running
  16. ...

Then you will be able to visit this application via its domain.

  1. curl -H "Host:testsvc.example.com" http://<your ip address>/
  1. <xmp>
  2. Hello World
  3. ## .
  4. ## ## ## ==
  5. ## ## ## ## ## ===
  6. /""""""""""""""""\___/ ===
  7. ~~~ {~~ ~~~~ ~~~ ~~~~ ~~ ~ / ===- ~~~
  8. \______ o _,/
  9. \ \ _,'
  10. `'--.._\..--''
  11. </xmp>

⚠️ This section requires your runtime cluster has a working ingress controller.