Kubernetes: Ingress commands on kubectl to change ingress configuration

5/16/2018

Are the any kubectl commands available in order to interact with ingress?

The desired outcome would be to temporary change the service which a host is mapped and the revert by using kubectl.

My goal is to avoid the using the edit option of kubectl and have a workaround by using something close to the set command.

EDIT

The goal was to simulate green blue deployment in an automated environment using ingress. Kubectl does not support updating the values of ingress or the services therefore 'kubectl edit' or 'kubect apply' has to be used.

-- gkatzioura
kubectl
kubernetes
kubernetes-ingress

1 Answer

5/16/2018

You can't manage Ingress backends directly with Kubectl. What I suggest to you is to deploy your two deployment with labels :

  • deploy01 - blue
  • deploy02 - green

Expose Blue with a service/ingress.

When you want to migrate from blue to green, simply edit your Service component to point to the green deployment like :

kubectl edit service myservice

Replace "blue" by "green" and Here we are, Your ingress controller will change his backend to the Green's ones.

-- Valentin Ouvrard
Source: StackOverflow