4

I have multiple environments represented by multiple namespaces in my kubernetes.

All application has its service endpoints defined in each namespace. And we have three environments, dev, alpha, and beta. (Which is equivalent of dev, test, and stage). These environments are permanent, which means all the applications are running there.

Now in my team, there are few parallel development happening, for which we are planning to create multiple environments for the release and which will be only having few applications which are part of that release.

Let's think of this example: I am building feature1 and have an impact on app1 and app2

There are 10 other apps which are not having any impact.

So for my development and the parallel testing majority of services that I have to point to existing alpha or beta env and only point the app1 and app2 in the namespace.

I could achieve this by having an ExternalName mapping for all other services.

But if I have more than 100 services and managing the external endpoint in a yaml I feel very difficult.

Is there any way that I can route all the traffic to another namespace(If there exist no service with that name.)

Is there a way for global ExternalName for a Namespace?

Arslanbekov Denis
  • 1,674
  • 12
  • 26
Ysak
  • 2,601
  • 6
  • 29
  • 53
  • Where will this be running? You're using own bare metal or any cloud providers? I'm asking because I would recommend LoadBalancer, if it's bare metal check [service-loadbalancer](https://github.com/kubernetes/contrib/tree/master/service-loadbalancer), GCP and AWS have their own LBs. – Crou Oct 22 '18 at 12:20
  • I run on aws using kops – Ysak Oct 22 '18 at 12:32
  • maybe u can use gitlab auto devops with environments feature – Ijaz Ahmad Jan 27 '19 at 17:40

1 Answers1

0

As far as I know, it is not possible to redirect traffic to a different namespace based on the existing pods or Services in the current namespace. You can select a destination for Service only by changing its YAML configuration, and it is only possible to select pods in the same namespace.

You can simplify the deployment procedure by using Helm charts. It allows you to put variables into YAML configuration of Deployments, Services, etc, and use separate value file to substitute them during installation to the cluster. Here is a link to a blog post on Using Helm to deploy to Kubernetes

Crou
  • 10,232
  • 2
  • 26
  • 31
  • This procedure is not so manageable because there are 100s of services in an env. So managing them using helm will be more difficult. More over i want to auto spawn new release environment per user. – Ysak Oct 22 '18 at 18:02
  • So you are thinking of some CICD or just some ansible? – Crou Oct 23 '18 at 11:51
  • I am thinking some kind of hooks in the system level, which can behave as fallback service defenition which point to external , similar to ExternalName kind – Ysak Oct 24 '18 at 03:54
  • I think this should help in your case [Istio - Traffic Shifting](https://istio.io/docs/tasks/traffic-management/traffic-shifting/) – Crou Oct 24 '18 at 13:37