Have istio integrated to the k8s cluster. I am trying to curl to a etcd pod behind headless service (one of three pods) from the ubuntu pod (this pod also has envoy) in the same namespace.
I am seeing 404 page not found when I curl to the headless service etcd pods.
I tried creating a virtual service and destination rule
apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
name: etcd-route-rule
namespace: aks-istio-system
spec:
hosts:
- "*"
http:
- route:
- destination:
host: <etcd-pod>.<headless-svc-name>.ns.svc.cluster.local
port:
number: 2380
apiVersion: networking.istio.io/v1beta1
kind: DestinationRule
metadata:
name: etcd-mtls-dstrule
namespace: aks-istio-system
spec:
host: <etcd-pod>.<headless-svc-name>.ns.svc.cluster.local
trafficPolicy:
tls:
mode: ISTIO_MUTUAL
I started getting 503 error. What am I doing wrong here?
To set up your environment correctly and avoid the errors you're encountering with Istio and your etcd service, follow these steps:
Deploy Your etcd Cluster with a Headless Service
Deploy etcd Pods: Ensure your etcd pods are deployed in Kubernetes. You might be using a StatefulSet for this, which is typical for etcd clusters.
Create a Headless Service: Define a headless service in Kubernetes for your etcd cluster. Here's an example service definition:
Install and Configure Istio to enable automatic sidecar injection
Ensure that your etcd pods have the Istio sidecar injected. If they were running before Istio was enabled, you might need to recreate the pods.
next configure Istio Networking by creating a VirtualService to manage the traffic to your etcd headless service and a DestinationRule to specify traffic policies, such as TLS settings.
virtualService.yaml
DestinationRule.yaml
Now that the Istio networking objects are in place, you can test the connectivity. Since the
etcdpods are likely to be part of the etcd cluster itself and might not havecurlinstalled, you'll need a separate pod within theaks-istio-systemnamespace that hascurlavailable. If you don't have a suitable pod already, you can create a temporary one for testing purposes. Here's how you can deploy a simple Ubuntu pod and then use it to test the connectivity. Create a file namedubuntu-pod.yamlwith the following content:Deploy the pod
Once pod is up, exec into it.
and finally
curl http://etcd-headless.aks-istio-system.svc.cluster.local:2379/health