- What's New
- Product Bulletin
- Service Overview
- Billing
- Getting Started
-
User Guide
- Application Service Mesh
- Buying a Service Mesh
- Mesh Management
- Service Management
- Gateway Management
- Grayscale Release
- Mesh Configuration
- Traffic Management
- Security
-
Best Practices
- Upgrading Data Plane Sidecars Without Service Interruption
- Service Governance for Dubbo-based Applications
- Reserving Source IP Address for Gateway Access
- Creating a Service Mesh with IPv4/IPv6 Dual Stack Enabled
- How Do I Query Application Metrics in AOM?
- Reducing the Agency Permissions of ASM Users
- Istio-ingressgateway HA Configuration
-
FAQs
- Service Mesh Cluster
-
Mesh Management
- Why Cannot I Create a Mesh for My Cluster?
- Why Are Exclusive Nodes Still Exist After Istio Is Uninstalled?
- How Do I Upgrade ICAgent?
- How Do I Enable Namespace Injection for a Cluster?
- How Do I Disable Sidecar Injection for Workloads?
- What Can I Do If A Pod Cannot Be Started Due to Unready Sidecar
- How Do I Handle a Canary Upgrade Failure?
-
Adding a Service
- What Do I Do If an Added Gateway Does Not Take Effect?
- Why Does It Take a Long Time to Start the Demo Application in Experiencing Service Mesh in One Click?
- Why Cannot I Access the page of the Demo Application After It Is Successfully Deployed?
- Why Cannot I Select the Corresponding Service When Adding a Route?
- How Do I Inject a Sidecar for the Pod Created Using a Job or CronJob?
- Performing Grayscale Release
-
Managing Traffic
- Why Are the Created Clusters, Namespaces, and Applications Not Displayed on the Traffic Management Page?
- How Do I Change the Resource Requests of the istio-proxy Container?
- Does ASM Support HTTP/1.0?
- How Can I Block Access from Some IP Address Ranges or Ports for a Service Mesh?
- How Do I Configure max_concurrent_streams for a Gateway?
- How Do I Fix Compatibility Issues Between Istio CNI and Init Containers?
-
Monitoring Traffic
- Why Cannot I View Traffic Monitoring Data Immediately After a Pod Is Started?
- Why Are the Latency Statistics on the Dashboard Page Inaccurate?
- Why Is the Traffic Ratio Inconsistent with That in the Traffic Monitoring Chart?
- Why Can't I Find Certain Error Requests in Tracing?
- Why Cannot I Find My Service in the Traffic Monitoring Topology?
- How Do I Connect a Service Mesh to Jaeger or Zipkin for Viewing Traces?
- Videos
-
More Documents
-
User Guide (ME-Abu Dhabi Region)
- Service Overview
- Getting Started
- User Guide
-
FAQs
- Service Mesh Cluster
- Mesh Management
-
Adding a Service
- What Do I Do If an Added Gateway Does Not Take Effect?
- Why Does It Take a Long Time to Start the Demo Application in Experiencing Service Mesh in One Click?
- Why Cannot I Access the page of the Demo Application After It Is Successfully Deployed?
- Why Cannot I Select the Corresponding Service When Adding a Route?
- Performing Grayscale Release
-
User Guide (ME-Abu Dhabi Region)
- General Reference
Copied.
Reserving Source IP Address for Gateway Access
If node affinity is configured, the ELB address cannot be used to access workloads in some scenarios. For details, see Why the ELB Address Cannot Be Used to Access Workloads in a Cluster?
Scenario
When a service is accessed through a gateway, the source IP address displayed in the target container is not the source IP address of the client by default. To retain the source IP address, perform the operations described in this section.
Configuration
Log in to the CCE console. On the Networking page, select the istio-system namespace, update the gateway service associated with the service, and change Service Affinity to Node-level. The prerequisite is that the function of obtaining the client IP address of the ELB has been enabled (this function is enabled by default).
externalTrafficPolicy: indicates whether the Service wants to route external traffic to the local nodes or cluster-wide endpoints. Two options are available: Cluster (default) and Local. Cluster hides the client IP address, which may cause the second hop to another node, but has a good overall load distribution. Local retains the source IP address of the client and avoids the second hop of LoadBalancer and NodePort services. However, there is a potential risk of unbalanced traffic transmission.
Authentication Method
The x-forward-for field of the httpbin image displays the source IP address. The httpbin service is an HTTP Request & Response Service that can send requests to the httpbin image. The httpbin image will return the requests based on the specified rules. You can search for the httpbin image in SWR. Before using the httpbin image for verification, ensure that the mesh function has been enabled for the cluster.
- Log in to the ASM console and click the name of an available test mesh to go to its details page.
- In the navigation pane, choose Mesh Configuration. Then, view the associated cluster.
- Click the cluster name to go to the cluster console. In the navigation pane, choose Workloads. On the Deployments tab, click Create Workload in the upper right corner.
- Configure workload information.
- Workload Type: Select Deployment.
- Workload Name: Enter httpbin.
- Namespace: Select the namespace of the workload. The default value is default.
- Retain the default values of other parameters.
Container Configuration
- Basic Information
- Container Name: Customize a name.
- Image Name: Click Select Image, search for the httpbin image, select the image, and click OK.
- Image Tag: Select an image tag.
- Retain the default values of other parameters.
Service Settings
A Service solves the pod access problems. With a fixed IP address, a Service forwards access traffic to pods and performs load balancing for these pods.
Click + under the service configuration parameter to go to the Create Service page.- Service Name: Enter the workload name.
- Service Type: Select ClusterIP.
- Port parameters:
- Protocol: Select TCP.
- Container Port: 80 (Use the actual port number.)
- Service Port: 80 (Use the actual port number.)
- Click OK in the lower right corner.
- Click Create Workload in the lower right corner.
- On the cluster console, click Networking in the navigation pane. The created httpbin service is displayed in the service list.
- Return to the ASM console and click Service Management. The Configuration Diagnosis Result of the httpbin service is Abnormal.
- Click Fix. In Configuration Diagnosis Result, rectify the fault by following the solution.
Take "The Service port name complies with the Istio specifications" as an example. Select http and click Auto Fix.
- In the navigation pane, choose Gateway Management. Then, click Add Gateway in the upper right corner. Configure the parameters in the window that slides out from the right.
Configuration Information
- Gateway Name: Enter httpbin.
- Cluster: Select the cluster associated with the mesh.
- Load Balancer: Select Public network and select a load balancer.
- External Protocol: Select HTTP.
- External Port: Specify a port.
- External Access Address: Enter the public IP address of the load balancer selected for the Load Balancer.
- Click + under Routing. In the Add Route dialog box displayed, add a route.
- URL: Select Full match and enter a mapping.
- Namespace: Select the namespace to which the service belongs.
- Target Service: Retain the default value.
When the configuration is complete, click OK.
- Click OK.
- Click Service Management on the left. You can view the external access address of the created route in the Access Address column.
- Add ?show_env=1 to the mapped external access address, for example, http://xxx.xxx.xxx:80/get?show_env=1. You can view the value of the x-forward-for field. The IP address obtained by the gateway is the container IP address.
... ... ... x-forward-for: xxxx
- Return to the cluster console, click Networking in the navigation pane, and modify the configuration of the gateway service associated with the service as follows:
Select the istio-system namespace.
Click More > Update in the Operation column. On the Update Service page displayed, change Service Affinity to Node-level, select I have read Notes on Using Load Balancers, and click OK.
- Return and refresh the external IP address accessed in 13. If the IP address obtained by the gateway in the x-forward-for field is the source IP address of the local host, the verification is complete.
... ... ... x-forward-for: xxxx
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot