Version: v1.0

Ingress

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

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

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

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
  2. 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
  2. NAME COMPONENT TYPE PHASE HEALTHY STATUS AGE
  3. first-vela-app express-server webservice healthChecking 14s
  4. 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
  2. apiVersion: core.oam.dev/v1beta1
  3. kind: Application
  4. metadata:
  5. name: first-vela-app
  6. namespace: default
  7. spec:
  8. ...
  9. services:
  10. - healthy: true
  11. name: express-server
  12. traits:
  13. - healthy: true
  14. message: 'Visiting URL: testsvc.example.com, IP: 47.111.233.220'
  15. type: ingress
  16. status: running
  17. ...

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

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