'What is fully qualified service name for a service in minikube

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

Added by BMW

The user in fact is asking a XY Problem

Here is the real question, he put in comment.

I want to make use of kubectl port forwarding technique to forward traffic from external world to service running inside minikube so that I can access it from outside I am trying below command :

kubectl port-forward --address 0.0.0.0 svc/kiali.istio-system.svc.cluster.local 31000 31000 
Error from server (NotFound): services "kiali.istio-system.svc.cluster.local" not found



Solution 1:[1]

Realized the user is asking XY Problem

I put the answer here:

kubectl -n istio-system port-forward --address 0.0.0.0 svc/kiali 31000 31000 

with -n istio-system, you can nominiate the namespace you are working on, and no need care of its domain name postfix.

Here is the original answer, but still useful for some use cases.

Please reference this:enter image description here

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.

Solution 2:[2]

You can also use kiali service type to NodePort to expose the service on the minikube host server.

Solution 3:[3]

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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Subramanian Manickam
Solution 3 Shashank V