Edit Microservice Gateway
This section describes how to edit a microservice gateway.
Prerequisites
-
KubeSphere platform needs to have the KubeSphere Spring Cloud extension installed and enabled.
-
You need to join a project and have the Spring Cloud Microservices Management permission in the project. For more information, see Project Members and Project Roles.
Steps
-
Log in to the KubeSphere web console with a user who has Spring Cloud Microservices Management permissions and enter your workspace.
-
Click Spring Cloud > Microservice Gateway in the left navigation pane.
-
Select a project from the drop-down list in the upper left corner of the page.
-
On the right side of the page, select Manage > Edit.
-
In the Edit Microservice Gateway dialog box, modify the parameters of the microservice gateway, then click OK.
For more information about microservice gateway parameters, please refer to Parameter Description.
Parameter Description
The following describes how to set the parameters for the microservices gateway.
-
Basic Information
Parameter Description Name
The name of the microservices gateway, which is also the name of the corresponding deployment. The name can only contain lowercase letters, numbers, and hyphens (-), must start and end with a lowercase letter or number, and can be up to 63 characters long.
Image
The container image used to create the microservices gateway. For example, registry.cn-beijing.aliyuncs.com/kse/spring-cloud-gateway:latest.
Replicas
The number of pod replicas for the microservices gateway deployment.
-
Resource Quotas
Set the resource requests and limits for each container of the microservices gateway.
Parameter Description CPU Request
The CPU resources reserved for the container, in cores.
CPU Limit
The maximum CPU resources allowed for the container, in cores.
Memory Request
The memory resources reserved for the container, in MiB.
Memory Limit
The maximum memory resources allowed for the container, in MiB.
-
Port Settings
Set the ports for the service that exposes the microservices gateway.
Parameter Description Protocol
The actual protocol listened to by the application in the target container.
Name
The name of the service port.
Container Port
The actual port number listened to by the application in the target container. If using the example container image registry.cn-beijing.aliyuncs.com/kse/spring-cloud-gateway:latest, set the container port number to 8080.
Service Port
The port number of the service.
Click Add to set multiple service ports. Click
on the right side of a created service port to delete it.
-
Image Pull Policy
Configure whether to pull images from the image service when creating or updating a pod.
Parameter Description Prefer Local Image
When creating or updating a pod, prioritize using the image files stored on the node by the container runtime.
Always Pull Image
When creating or updating a pod, always attempt to pull the image from the image service.
Use Local Image Only
When creating or updating a pod, use only the images stored on the node by the container runtime. If the required image does not exist locally, pod creation will fail.
-
Health Check
Check the health status of containers. Before using this feature, you need to configure your container’s application to return health check results.
KubeSphere supports the following health check types:
Parameter Description Liveness Probe
Checks if the container is alive. If the liveness probe fails, the system will attempt to restart the container.
Readiness Probe
Checks if the container is ready. If the readiness probe fails, the system will prevent access to the pod where the container resides via services.
Startup Probe
Checks if the container has started. If the startup probe fails, the system will disable other probes for the container and attempt to restart the container.
KubeSphere supports the following check methods:
Parameter Description HTTP Request
Sends an HTTP GET request to the pod’s virtual IP address. The check is successful if the response status code is 2XX or 3XX.
Command
Runs a command inside the container. The check is successful if the command’s exit code is 0.
TCP Port
Attempts to establish a TCP connection to the specified container port. The check is successful if the connection is established.
-
Environment Variables
Set environment variables for the container.
-
Click Add Environment Variable to set multiple environment variables.
-
Click Batch Reference to create environment variables using data from a ConfigMap or Secret. The ConfigMap or Secret must belong to the same project as the container to be referenced by the container. After the container is created, the values of the environment variables will not change dynamically with updates to the ConfigMap or Secret settings.
-
Click
on the right side of a created environment variable to delete it.
Parameter Description Key
The name of the environment variable.
Value
The value of the environment variable.
Resource
The name of the ConfigMap or Secret. Only available when referencing a ConfigMap or Secret.
Key in Resource
The key within the ConfigMap or Secret. The value corresponding to this key will be used as the value of the environment variable. Only available when referencing a ConfigMap or Secret.
-
-
Startup Command
Set the command to be executed inside the container when it starts.
Parameter Description Command
The name of the command to be executed.
Arguments
The arguments for the command to be executed. You can use commas (,) to separate multiple arguments.
-
Advanced Settings > External Access
Set whether to allow access to the microservices gateway from outside the KubeSphere cluster. If external access is enabled, you need to select the external access mode.
Parameter Description NodePort
The system maps a node’s port to the service port, allowing the service to be accessed via the node’s IP address and the node port.
LoadBalancer
Based on a NodePort service, the system assigns an external IP address to the service and binds it to an external load balancer. The external load balancer listens on the node port corresponding to the service, enabling access to the service via the external IP address. To achieve this, a LoadBalancer type service requires support from a load balancer plugin and the infrastructure environment, and relevant annotations need to be set. For more information, please contact your infrastructure environment provider.