×
Community Blog A New Paradigm for Cloud-native Gateway Deployment | Higress 1.1 Supports Non-Kubernetes Deployment

A New Paradigm for Cloud-native Gateway Deployment | Higress 1.1 Supports Non-Kubernetes Deployment

This article introduces the core features of Higress 1.1.0.

By Chengtan

Higress 1.1.0 was released. In Kubernetes environments, you can run the following command to upgrade Higress to the version 1.1.0:

kubectl apply -f https://github.com/alibaba/higress/releases/download/v1.1.0/customresourcedefinitions.gen.yaml
helm repo update
helm upgrade higress -n higress-system higress.io/higress

The core features of this release are described below:

Support Non-Kubernetes Deployment

In Kubernetes deployment mode, Higress supports service discovery through Nacos, enabling the integration of microservice ecosystems like Spring Cloud and Dubbo. Acting as a comprehensive solution for microservice ecosystems, Nacos serves as both a registry and a configuration center. In non-Kubernetes environments, by storing configurations such as routes and plugins in Nacos, users only need Higress and Nacos to handle everything.

1

In version 1.1, Higress successfully implemented this feature. As depicted in the architecture diagram above, Nacos can serve as both the source of route configuration and the source of service IP. This is made possible by utilizing the Ingress API, which is a basic API abstraction for storing route configurations in Nacos. With this architecture, Higress is capable of implementing various functionalities on Kubernetes.

Deploying in a non-Kubernetes environment is as simple as running a one-line command (compatible with macOS and Linux, with Windows requiring the installation of Cygwin).

curl -fsSL https://higress.io/standalone/get-higress.sh | bash -s -- -c nacos://<nacos_addr>:8848

The -c parameter specifies the configuration storage source in non-Kubernetes scenarios. In Nacos, you can use nacos:// to specify the configuration storage source. In this mode, all Higress configurations are stored in Nacos. In the future, configuration sources such as ETCD and Consul will be supported.

You can use the -h parameter to view more parameters. Details are as follows:

Usage: bash [DIR] [OPTIONS...]
Install Higress (standalone version) into the DIR (the current directory by default).

 -c, --config-url=URL       URL of the Nacos service
                            format: nacos://192.168.0.1:8848
     --use-builtin-nacos    use the built-in Nacos service instead of
                            an external one
     --nacos-ns=NACOS-NAMESPACE
                            the ID of Nacos namespace to store configurations
                            default to "higress-system" if unspecified
     --nacos-username=NACOS-USERNAME
                            the username used to access Nacos
                            only needed if auth is enabled in Nacos
     --nacos-password=NACOS-PASSWORD
                            the password used to access Nacos
                            only needed if auth is enabled in Nacos
 -k, --data-enc-key=KEY     the key used to encrypt sensitive configurations
                            MUST contain 32 characters
                            A random key will be generated if unspecified
 -p, --console-password=CONSOLE-PASSWORD
                            the password to be used to visit Higress Console
                            default to "admin" if unspecified
 -h, --help                 give this help list

After the startup is successful, the port usage of the local machine is as follows:

• Port 80: Higress Gateway is exposed. It is used for HTTP proxy.
• Port 443: Higress Gateway is exposed. It is used for HTTPS proxy.
• Port 15020: Higress Gateway is exposed. It is used to expose the Prometheus metric (http://node_ip:15020/stats/prometheus).
• Port 8080: Higress Console is exposed. It is used for Higress console management.

Let's start a SpringCloud service locally and register it on this Nacos:

2

Additionally, you can find this service listed in the service list within the Higress console. By default, Higress is configured to monitor the public namespace of Nacos specified in the startup parameters. You also have the option to add other namespaces to the service source.

3

Create a route for this service:

4

The test for the route is successful:

5

Simplify the HTTP to Dubbo Configuration

In previous versions, enabling the Http to Dubbo capability required the use of Istio CRD and configuring it with EnvoyFilter. However, Higress 1.1 introduces the Http2Rpc CRD to simplify the configuration process for Http to Dubbo.

Suppose we have deployed the following Dubbo service. Its service name is com.alibaba.nacos.example.dubbo.service.DemoService, and the version of the service is specified as 1.0.0, and the group is specified as dev:

Interface:

package com.alibaba.nacos.example.dubbo.service;

public interface DemoService {
    String sayName(String name);
}

Implement:

@DubboService(version = "${demo.service.version}", group = "${demo.service.group}")
public class DefaultService implements DemoService {

    @Value("${demo.service.name}")
    private String serviceName;

    public String sayName(String name) {
        RpcContext rpcContext = RpcContext.getContext();
        return String.format("Service [name :%s , port : %d] %s(\"%s\") : Hello,%s",
                serviceName,
                rpcContext.getLocalPort(),
                rpcContext.getMethodName(),
                name,
                name);
    }
}

Create an Http2Rpc CRD

apiVersion: networking.higress.io/v1
kind: Http2Rpc
metadata:
  name: httproute-http2rpc-demo
  namespace: higress-system
spec:
  dubbo: 
    service: com.alibaba.nacos.example.dubbo.service.DemoService
    version: 1.0.0
    group: dev
    methods: 
    - serviceMethod: sayName
      headersAttach: "*"
      httpMethods: 
      - "GET"
      httpPath: "/dubbo/sayName"
      params:
      - paramKey: name
        paramSource: QUERY
        paramType: "java.lang.String"

Create an Ingress to Associate with Http2Rpc

apiVersion: networking.k8s.io/v1
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    higress.io/destination: providers:com.alibaba.nacos.example.dubbo.service.DemoService:1.0.0:dev.DEFAULT-GROUP.public.nacos
    higress.io/rpc-destination-name: httproute-http2rpc-demo
  name: httproute-http2rpc-demo-ingress
  namespace: higress-system
spec:
  ingressClassName: higress
  rules:
  - http:
      paths:
      - backend:
          resource:
            apiGroup: networking.higress.io
            kind: McpBridge
            name: default
        path: /dubbo
        pathType: Prefix

With the above configurations, we can run the following curl command to call this dubbo service:

$curl "localhost/dubbo/sayName?name=abc" 

{"result":"Service [name :demoService , port : 20880] sayName(\"abc\") : Hello,abc"}

Support the SkyWalking Tracing Configuration

The global configuration ConfigMap object of Higress, higress-config, should be configured as follows to enable SkyWalking Tracing:

apiVersion: v1
data:
  higress: |-
    tracing:
      enable: true
      sampling: 100
      timeout: 500
      skywalking:
       service: skywalking-oap-server.op-system.svc.cluster.local
       port: 11800
...
...
kind: ConfigMap
metadata:
  name: higress-config
  namespace: higress-system

Trace:

6

Trace topology:

7

Related Links

0 1 0
Share on

You may also like

Comments

Related Products