How to edit an existing ingress nginx rule in azure kubernetes cluster

Abhishek Singh 381 Reputation points
2022-10-01T14:57:40.653+00:00

I have an aks cluster with nginx ingress rules created pointing to 3 backend services now I want to point the backend to different services, is it possible to edit the existing rules, I am new to aks and ingress so please guide.

Azure Kubernetes Service
Azure Kubernetes Service
An Azure service that provides serverless Kubernetes, an integrated continuous integration and continuous delivery experience, and enterprise-grade security and governance.
2,456 questions
0 comments No comments
{count} votes

Accepted answer
  1. shiva patpi 13,366 Reputation points Microsoft Employee Moderator
    2022-10-02T00:07:51.467+00:00

    Hello @Abhishek Singh ,
    You can edit the ingress file to change the backend service names:
    For example you can follow below steps:

    kubectl get ingress (Get the current ingress)

    PS C:\aks> kubectl get ingress
    NAME CLASS HOSTS ADDRESS PORTS AGE
    ingressnginx <none> * 52.152.91.154 80 10m

    Edit the ingress by outputting to YAML file

    kubectl edit ingress ingressnginx -o yaml (It will open a new file in a notepad)

    PS C:\aks> kubectl edit ingress ingressnginx -o yaml
    ingress.networking.k8s.io/ingressnginx edited

    In the notepad , you can go-ahead and modify the service name and save it.

    Let us know if you have follow-up questions.

    Regards,
    Shiva.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.