kubevela.github.io/docs/reference/addons/nginx-ingress-controller.md

2.0 KiB

title
Nginx Ingress Controller

Nginx Ingress controller is an Ingress controller for Kubernetes using NGINX as a reverse proxy and load balancer.

:::note If your cluster is already have any kinds of ingress controller, you don't need to enable this addon. :::

Install

vela addon enable ingress-nginx

Setup with Specified Service Type

There are three service types for this addon which aligned with Kubernetes service, they're ClusterIP, NodePort and LoadBalancer. By default, the service type is ClusterIP for security.

  • LoadBalancer type requires your cluster has cloud LoadBalancer available.
    vela addon enable ingress-nginx serviceType=LoadBalancer
    
  • NodePort type requires you can access the Kubernetes Node IP/Port.
    vela addon enable ingress-nginx serviceType=NodePort
    

Get access address

After specify the service type to LoadBalancer or NodePort, you can obtain the access address through vela status:

vela status addon-ingress-nginx -n vela-system --endpoint

If the service type is ClusterIP, you use vela port-forward map the ingress-controller's port to local

vela port-forward -n vela-system addon-ingress-nginx 9080:80

Uninstall

vela addon disable ingress-nginx

Example

Use this addon by deploy an application:

cat <<EOF | vela up -f -
apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
  name: demo
spec:
  components:
  - name: demo
    type: webservice
    properties:
      image: barnett/canarydemo:v1
      ports:
      - port: 8090
    traits:
    - type: gateway
      properties:
        domain: canary-demo.com
        http:
          "/version": 8090
EOF

Then access the gateway's endpoint will see:

$ curl -H "Host: canary-demo.com" <ingress-nginx-endpoint>/version
Demo: V1