Service located in another namespace

前端 未结 4 1938
無奈伤痛
無奈伤痛 2020-11-28 01:29

I have been trying to find a way to define a service in one namespace that links to a Pod running in another namespace. I know that containers in a Pod running in nam

4条回答
  •  [愿得一人]
    2020-11-28 01:55

    It is so simple to do it

    if you want to use it as host and want to resolve it

    If you are using ambassador to any other API gateway for service located in another namespace it's always suggested to use :

                Use : 
                Use : .
                Not : ..svc.cluster.local
    

    it will be like : servicename.namespacename.svc.cluster.local

    this will send request to a particular service inside the namespace you have mention.

    example:

    kind: Service
    apiVersion: v1
    metadata:
      name: service
    spec:
      type: ExternalName
      externalName: ..svc.cluster.local
    

    Here replace the and with the appropriate value.

    In Kubernetes, namespaces are used to create virtual environment but all are connect with each other.

提交回复
热议问题