You need to enable JavaScript to run this app.
Volcengine Kubernetes Engine

Volcengine Kubernetes Engine

Copy page
Download PDF
ALB Ingress
Using ALB Ingresses for service deployment
Copy page
Download PDF
Using ALB Ingresses for service deployment
An Application Load Balancer (ALB) Ingress, built on the Volcano Engine ALB, offers more comprehensive Layer 7 load balancing capabilities. This topic introduces how to release services by using ALB Ingresses and related considerations.​
warning​
It is highly recommended that you first read Considerations for using ALB Ingresses carefully before getting started.​
Limit​
  • To prevent ALB exceptions, do not directly modify an ALB instance, its listeners, back-end server groups, or forwarding rules managed by an ALB Ingress from the ALB console. Any such modifications are undertaken at your own risk.​
  • Do not modify any content prefixed with k8s_ in the name of a listener or backend server group.​
  • Do not modify any content prefixed with k8s_ in the description of a forwarding rule.​
  • Using the ALB console to modify resources and configurations specified or maintained by an ALB Ingress (for example, forwarding rules) may cause configurations to be overwritten.​
  • Using ALB incurs fees for the use of cloud infrastructure resources. For details, see ALB billing.​
Procedure​
Step 1: Create an ALBInstance​
  1. Log in to the VKE console.​
  1. In the left navigation bar, click Cluster.​
  1. On the Cluster page, click the name of the target cluster.​
  1. In the left navigation bar, click Workload > Resource Explorer. Click Create with Yaml to create an ALBInstance.​
  • Select Custom from the Type drop-down menu.​
  • Edit the configurations in the Yaml box.​
​
apiVersion: loadbalancer.vke.volcengine.com/v1beta1​
kind: ALBInstance​
metadata:​
name: alb # The name of the ALBInstance.​
spec:​
instanceID: "alb-2dgns526uiv41fi5********" # The ID of the existing ALB instance.​
listeners:​
- protocol: "HTTP" # The protocol for the listener.​
port: 80 # The port used for HTTP listeners.​
​
tip​
In this example, the ALBInstance will be created using an existing ALB instance, which only requires a simple configuration. For more configuration details, see Creating ALB Ingresses by using kubectl.​
  1. After the ALBInstance resource is created, click albinstance on the Resource Explorer page to view details of the resource.​
Step 2: Deploy an application and service​
  1. Create the YAML file of the workload. The code of the sample file deployment-demo.yaml is as follows:​
​
apiVersion: apps/v1​
kind: Deployment​
metadata:​
name: deployment-demo # Deployment name​
namespace: default # Namespace of the Deployment​
spec: ​
replicas: 1 # Number of replicas for the Deployment​
selector: ​
matchLabels: ​
app: nginx​
template: ​
metadata: ​
labels: ​
app: nginx​
spec:​
containers:​
- name: nginx # Container name​
image: nginx:latest # The container image address and tag.​
ports:​
- containerPort: 80 # Exposed container port number​
​
  1. Run the following command to create the workload.​
​
kubectl apply -f deployment-demo.yaml​
​
  1. A YAML file for creating the service. The code of the sample file deployment-demo.yaml is as follows:​
​
apiVersion: v1​
kind: Service​
metadata:​
name: service-demo # Service name​
spec:​
selector:​
app: nginx # Bind the service to backend pods via a label selector.​
ports:​
- name: rule # Port mapping rule name​
protocol: TCP # Service protocol, can be TCP or UDP​
port: 80 # Service port​
nodePort: 30000 # NodePort, which can be an integer from 30000 to 32767.​
targetPort: 80 # Container port, a port number or port name through which a workload provides service, e.g., the default port number for Nginx is 80​
type: NodePort # Service type​
​
warning​
  • When the network model of the cluster is Flannel, you can select only a NodePort or LoadBalancer service.​
  • When the network model of the cluster is VPC-CNI:​
  • If the LB-to-pod direct access mode is enabled for the Ingress, you can select a NodePort, LoadBalancer, or ClusterIP service.​
  • If the LB-to-pod direct access mode is not enabled for the Ingress, you can select only a NodePort or LoadBalancer service.​
  1. Execute the following command to create a service.​
​
kubectl apply -f service-demo.yaml​
​
Step 3: Create an ALB Ingress​
  1. Create a YAML file for the Ingress. The following alb-ingress.yaml file provides an example:​
  • ​
    apiVersion: networking.k8s.io/v1​
    kind: Ingress​
    metadata:​
    name: alb-ingress-demo # The name of the Ingress.​
    namespace: default # Namespace of the Ingress​
    spec:​
    ingressClassName: alb # The name of the ALBInstance.​
    rules:​
    - host: example.com # Domain names for external access​
    http:​
    paths:​
    - pathType: Prefix # Path matching rule, with Prefix (prefix matching) as the default setting.​
    path: / # The matching path for the request.​
    backend:​
    service:​
    name: service-demo # The name of the service to forward requests to.​
    port: ​
    number: 80 # The service port number to forward to.​
    ​
tip​
This example uses the simplest method to create an ALB Ingress. For more configuration details, see Creating ALB Ingresses by using kubectl.​
  1. Run the following command to create the ALB Ingress.​
  • ​
    kubectl apply -f alb-ingress.yaml​
    ​
Validating results​
Access the service by using the domain name configured in the ALB Ingress.​
​
curl http://example.com​
​
The response similar to the following indicates that the back-end service can be accessed through the ALB Ingress.​
​
<!DOCTYPE html>​
<html>​
<head>​
<title>Welcome to nginx!</title>​
<style>​
html { color-scheme: light dark; }​
body { width: 35em; margin: 0 auto;​
font-family: Tahoma, Verdana, Arial, sans-serif; }​
</style>​
</head>​
<body>​
<h1>Welcome to nginx!</h1>​
<p>If you see this page, the nginx web server is successfully installed and​
working. Further configuration is required.</p>​
​
<p>For online documentation and support please refer to​
<a href="http://nginx.org/">nginx.org</a>.<br/>​
Commercial support is available at​
<a href="http://nginx.com/">nginx.com</a>.</p>​
​
<p><em>Thank you for using nginx.</em></p>​
</body>​
</html>​
​
​
Last updated: 2026.04.15 11:43:37