I have a service running in namespace istio-system , I want to connect it with pod in different namespace say default . My cluster is running on minikube . How to do the same ? I tried myService.istio-system.svc.cluster.local , but it didnot worked and from where its picking this i.e from which configuration file . I know in normal k8 cluster but not in minikube Any help would be appreciated
It worked a bit different in my case , we have to explicitly specify namespace (Not Using fully qualified Domain name ) . I got help from below post https://docs.giantswarm.io/guides/accessing-services-from-the-outside/ Thanks everyone for help kubectl port-forward -n istio-system --address 0.0.0.0 svc/kiali.istio-system.svc.cluster.local 31000 31000
Use the -n
option with kubectl
to port-forward to a service in different namespace.
kubectl port-forward --address 0.0.0.0 svc/kiali 31000:31000 -n istio-system
You can also use kiali service type to NodePort to expose the service on the minikube host server.
So in your case, if cross namespace, you have to use below names:
<service_name>.<namespace>
<service_name>.<namespace>.svc
<service_name>.<namespace>.svc.cluster.local
svc is for service, pod is for pod.
If you need double check the last two parts, use CoreDNS
as sample, check its configmap:
master $ kubectl -n kube-system get configmap coredns -o yaml
apiVersion: v1
data:
Corefile: |
.:53 {
errors
health
ready
kubernetes cluster.local in-addr.arpa ip6.arpa {
pods insecure
fallthrough in-addr.arpa ip6.arpa
ttl 30
}
prometheus :9153
forward . /etc/resolv.conf
cache 30
loop
reload
loadbalance
}
kind: ConfigMap
metadata:
creationTimestamp: "2020-01-28T11:37:40Z"
name: coredns
namespace: kube-system
resourceVersion: "179"
selfLink: /api/v1/namespaces/kube-system/configmaps/coredns
uid: 0ee90a0b-6c71-4dbf-ac8a-906a5b37ea4f
that's the configuration file for CoreDNS, and it is set cluster.local
as port of full DNS name.