I want to know how to use istio for egress load balancing.
We have 2 URL’s serving the same purpose and want istio to load balance the egress traffic between these 2 domains.
Below are the 2 url’s
https://server1.retailonlinedevikscluster-46e544cd60b778e71a17cbb7b32c6e71-0000.eu-gb.containers.appdomain.cloud/greet
https://server2.retailonlinedevikscluster-46e544cd60b778e71a17cbb7b32c6e71-0000.eu-gb.containers.appdomain.cloud/greet
I want my application to call a url http://myserver.com (this is a non-existing domain) and Istio should load balance the traffic between the above 2 url’s
Below is the config I tried but not working
---
apiVersion: networking.istio.io/v1beta1
kind: ServiceEntry
metadata:
name: external-svc-dns
spec:
hosts:
- myserver.com
ports:
- number: 80
name: http-port
protocol: HTTP
targetPort: 443
resolution: DNS
endpoints:
- address: server1.retailonlinedevikscluster-46e544cd60b778e71a17cbb7b32c6e71-0000.eu-gb.containers.appdomain.cloud
- address: server2.retailonlinedevikscluster-46e544cd60b778e71a17cbb7b32c6e71-0000.eu-gb.containers.appdomain.cloud
---
Istio Config map:
$ kubectl get configmap istio -n istio-system -o yaml
apiVersion: v1
data:
mesh: |-
defaultConfig:
discoveryAddress: istiod.istio-system.svc:15012
proxyMetadata:
ISTIO_META_DNS_AUTO_ALLOCATE: "true"
ISTIO_META_DNS_CAPTURE: "true"
tracing:
zipkin:
address: zipkin.istio-system:9411
defaultProviders:
metrics:
- prometheus
enablePrometheusMerge: true
outboundTrafficPolicy:
mode: REGISTRY_ONLY
rootNamespace: istio-system
trustDomain: cluster.local
meshNetworks: 'networks: {}'
kind: ConfigMap
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"v1","data":{"mesh":"defaultConfig:\n discoveryAddress: istiod.istio-system.svc:15012\n proxyMetadata: {}\n tracing:\n zipkin:\n address: zipkin.istio-system:9411\ndefaultProviders:\n metrics:\n - prometheus\nenablePrometheusMerge: true\noutboundTrafficPolicy:\n mode: REGISTRY_ONLY\nrootNamespace: istio-system\ntrustDomain: cluster.local","meshNetworks":"networks: {}"},"kind":"ConfigMap","metadata":{"annotations":{},"labels":{"install.operator.istio.io/owning-resource":"unknown","install.operator.istio.io/owning-resource-namespace":"istio-system","istio.io/rev":"default","operator.istio.io/component":"Pilot","operator.istio.io/managed":"Reconcile","operator.istio.io/version":"1.18.2","release":"istio"},"name":"istio","namespace":"istio-system"}}
creationTimestamp: "2023-08-12T22:45:11Z"
labels:
install.operator.istio.io/owning-resource: unknown
install.operator.istio.io/owning-resource-namespace: istio-system
istio.io/rev: default
operator.istio.io/component: Pilot
operator.istio.io/managed: Reconcile
operator.istio.io/version: 1.18.2
release: istio
name: istio
namespace: istio-system
resourceVersion: "5472"
uid: 42984edb-a3c7-49cb-a832-535440195208
apiVersion: networking.istio.io/v1beta1
kind: DestinationRule
metadata:
name: myserver
spec:
host: myserver.com
trafficPolicy:
tls:
mode: SIMPLE
loadBalancer:
simple: ROUND_ROBIN
outlierDetection:
consecutive5xxErrors: 1
interval: 15s
baseEjectionTime: 1m
I am trying to do curl http://myserver.com/greet
which should load balance between https://server1.retailonlinedevikscluster-46e544cd60b778e71a17cbb7b32c6e71-0000.eu-gb.containers.appdomain.cloud/greet
and https://server2.retailonlinedevikscluster-46e544cd60b778e71a17cbb7b32c6e71-0000.eu-gb.containers.appdomain.cloud/greet
Getting below error in side the pod
[root@nettools-deployment-6c9c47b98d-tjp6d /]# curl http://myserver.com/greet
<html><h1>Error 404</h1><br/>Page Not Found</html>