Environment 1: Use in K8s

Stage 1: Installation

Scenario 1: Use in a Standard K8s Cluster

Helm Installation Command

  1. helm repo add higress.io https://higress.io/helm-charts
  2. helm install higress -n higress-system higress.io/higress create-namespace render-subchart-notes

Obtain the LoadBalancer IP of Higress Gateway and write it down. You can use it and port 80 and 443 to access Higress Gateway.

  1. kubectl get svc -n higress-system higress-gateway -o jsonpath=’{.status.loadBalancer.ingress[0].ip}’

Scenario 2: Use in Local Environment

The following groups can be applied to all local K8s clusters. If there is already a test cluster running on your PC, you can go to Step 3 directly and install Higress.

Step 1: Install kubectl & kind

MacOS:

  1. # for Intel Macs
  2. [ $(uname -m) = x86_64 ] && curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.18.0/kind-darwin-amd64
  3. # for Apple Silicon Macs (M1/M2)
  4. [ $(uname -m) = arm64 ] && curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.18.0/kind-darwin-arm64
  5. chmod +x ./kubectl ./kind
  6. sudo mv ./kubectl ./kind /usr/local/bin

Use PowerShell in Windows:

Download kubectl v1.27.1 and kind v0.18.0.

Or if you have curl installed, use the following commands:

  1. curl.exe -Lo kind-windows-amd64.exe https://kind.sigs.k8s.io/dl/v0.18.0/kind-windows-amd64

Note: To find out the latest stable version of kubectl (for example, for scripting), take a look at https://dl.k8s.io/release/stable.txt.

Then rename downloaded kind-windows-amd64 or kind-windows-amd64.exe to kind.exe. And move both exe files to a file location on your system PATH.

Linux:

  1. chmod +x ./kubectl ./kind
  2. sudo mv ./kubectl ./kind /usr/local/bin
Step 2: Create and Activate kind

First, create a cluster config file: cluster.conf

  1. # cluster.conf
  2. kind: Cluster
  3. apiVersion: kind.x-k8s.io/v1alpha4
  4. nodes:
  5. - role: control-plane
  6. kubeadmConfigPatches:
  7. - |
  8. kind: InitConfiguration
  9. nodeRegistration:
  10. kubeletExtraArgs:
  11. node-labels: ingress-ready=true
  12. extraPortMappings:
  13. - containerPort: 80
  14. hostPort: 80
  15. protocol: TCP
  16. - containerPort: 443
  17. hostPort: 443
  18. protocol: TCP

Commands for Mac & Linux:

  1. kind create cluster name higress config=cluster.conf
  2. kubectl config use-context kind-higress

Commands for Windows:

  1. kind.exe create cluster name higress config=cluster.conf
  2. kubectl.exe config use-context kind-higress

Note

currently, the namespace higress-system has a svc which type is LoadBalancer, it can not get IP in cluster by default. we can use official support to enable this function,please refer to https://kind.sigs.k8s.io/docs/user/loadbalancer/

Step 3: Install Higress

when you install higress in local environment, you should use --set global.local=true.

  1. helm repo add higress.io https://higress.io/helm-charts
  2. helm install higress -n higress-system higress.io/higress create-namespace render-subchart-notes set global.local=true set global.o11y.enabled=false

If you’d like to enable the built-in o11y suite, please refer to the Deploy by Helm document.

After installation, you can access Higress Gateway in the local cluster via port 80 and 443.

Note: If you are using a pre-existed local K8s cluster, you may need to use the command below to forward ports out of the cluster, and try the local ports later.

  1. kubectl port-forward service/higress-gateway -n higress-system 80:80 443:443

Stage 2: Configuration

Assuming that there is already a service named “foo” deployed in the default namespace, we’d like to create a route, forwarding http://foo.bar.com/foo requests to this service.

You can use the following YAML to create this test service if needed.

  1. kind: Pod
  2. apiVersion: v1
  3. metadata:
  4. name: foo-app
  5. labels:
  6. app: foo
  7. spec:
  8. containers:
  9. - name: foo-app
  10. image: higress-registry.cn-hangzhou.cr.aliyuncs.com/higress/http-echo:0.2.4-alpine
  11. args:
  12. - “-text=foo
  13. —-
  14. kind: Service
  15. apiVersion: v1
  16. metadata:
  17. name: foo-service
  18. spec:
  19. selector:
  20. app: foo
  21. ports:
  22. # Default port used by the image
  23. - port: 5678

Method 1: Use Higress Console

Use hgctl to open Higress Console.

  1. hgctl dashboard console

For the first time, you will need to configure the admin credentials.

image

After configuration, log into Higress Console using the credential just configured.

image

Click “Domain Management” on the navigation bar left. Click “Create Domain” button. Then fill the form according to the image below and click “Confirm” button.

image

Click “Route Management” on the navigation bar left. Click “Create Route” button. Then fill the form according to the image below and click “Confirm” button.

image

Method 2: Use Ingress CRD

Use the YAML below to create the test route we need.

  1. apiVersion: networking.k8s.io/v1
  2. kind: Ingress
  3. metadata:
  4. name: foo
  5. spec:
  6. ingressClassName: higress
  7. rules:
  8. - host: foo.bar.com
  9. http:
  10. paths:
  11. - pathType: Prefix
  12. path: “/foo
  13. backend:
  14. service:
  15. name: foo-service
  16. port:
  17. number: 5678

Stage 3: Validate

Use the following command to check whether the test route works properly:

  1. # should output “foo”
  2. curl http://GatewayIP/foo -H “Host: foo.bar.com”

Environment 2: Use in Docker Compose without K8s

Stage 1: Installation

Installation Command 1: Use a separated-deployed Nacos service

  1. curl -fsSL https://higress.io/standalone/get-higress.sh | bash -s — -a -c nacos://192.168.0.1:8848 —nacos-username=nacos —nacos-password=nacos

Please replace 192.168.0.1 with the actual IP address of Nacos service (if Nacos is deployed locally, please use a non-loopback address such as localhost or 127.0.0.1), and update the value of --nacos-username and --nacos-password based on actual configurations. If authentication isn’t enabled in Nacos, you can remove these two arguments.

Installation Command 2: Use the Higress Built-In Nacos

  1. curl -fsSL https://higress.io/standalone/get-higress.sh | bash -s — -a —use-builtin-nacos

Note: On Windows, you can use Unix-like shells such as Cygwin, Git Bash to execute the command above.

One-click deployment: We provide a one-click deployment to Alibaba Cloud solution, more convenient operation

Deploy on AlibabaCloud ComputeNest

Stage 2: Configuration

Open http://127.0.0.1:8080 in browser. For the first time, you will need to configure the admin credentials.

image

After configuration, log into Higress Console using the credential just configured.

image

Click “Service Sources” on the navigation bar left. Click “Create Service Source” button. Then fill the form according to the image below and click “Confirm” button.

image

Click “Domain Management” on the navigation bar left. Click “Create Domain” button. Then fill the form according to the image below and click “Confirm” button.

image

Click “Route Management” on the navigation bar left. Click “Create Route” button. Then fill the form according to the image below and click “Confirm” button.

image

Stage 3: Validate

Use the following command to check whether the test route works properly:

  1. # should output a JSON object containing request data
  2. curl http://localhost/get?foo=bar -H ‘host: foo.bar.com’