ingress-nginx icon indicating copy to clipboard operation
ingress-nginx copied to clipboard

Issue with canary annotation

Open tarun-asthana opened this issue 3 years ago • 12 comments

When I am using these annotations:

nginx.ingress.kubernetes.io/canary: true
nginx.ingress.kubernetes.io/canary-weight: 100

the host goes down even when the main endpoint is unresponsive.

Expected Behaviour: The host should not go down when the main endpoint is unresponsive since canary-weight is 100.

tarun-asthana avatar Jan 31 '22 17:01 tarun-asthana

@tarun-asthana: This issue is currently awaiting triage.

If Ingress contributors determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

k8s-ci-robot avatar Jan 31 '22 17:01 k8s-ci-robot

A reproducible example

apiVersion: apps/v1
kind: Deployment
metadata:
  name: canary-whoami
  labels:
    app: canary-whoami
spec:
  replicas: 1
  selector:
    matchLabels:
      app: canary-whoami
  template:
    metadata:
      labels:
        app: canary-whoami
    spec:
      containers:
      - name: whoami
        image: containous/whoami
        ports:
        - containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
  name: canary-whoami
spec:
  ports:
  - port: 80
    targetPort: 80
  selector:
    app: canary-whoami
---
apiVersion: v1
kind: Service
metadata:
  name: stable-whoami
spec:
  ports:
  - port: 80
    targetPort: 80
  selector:
    app: stable-whoami
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: stable-whoami
spec:
  ingressClassName: nginx
  rules:
  - http:
      paths:
      - pathType: Prefix
        path: "/"
        backend:
          service:
            name: stable-whoami
            port:
              number: 80
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: canary-whoami
  annotations:
    nginx.ingress.kubernetes.io/canary-weight: "100"
    nginx.ingress.kubernetes.io/canary: "true"
spec:
  ingressClassName: nginx
  rules:
  - http:
      paths:
      - pathType: Prefix
        path: "/"
        backend:
          service:
            name: canary-whoami
            port:
              number: 80
➜  k8s curl localhost/
<html>
<head><title>503 Service Temporarily Unavailable</title></head>
<body>
<center><h1>503 Service Temporarily Unavailable</h1></center>
<hr><center>nginx</center>
</body>
</html>

nissy34 avatar Jan 31 '22 17:01 nissy34

@tarun-asthana you can try following example with this you can easily deploy with canary annotation https://github.com/ContainerSolutions/k8s-deployment-strategies/tree/master/canary/nginx-ingress

kundan2707 avatar Feb 16 '22 19:02 kundan2707

/remove-kind bug /kind support

kundan2707 avatar Feb 16 '22 19:02 kundan2707

Thanks @kundan2707 ! However I didn't get how your repo was different from my problem. We are using the same annotations.

tarun-asthana avatar Feb 16 '22 19:02 tarun-asthana

@tarun-asthana only change that i can observe is sequence of nginx.ingress.kubernetes.io/canary: "true" As per official documentation annotations to configure canary can be enabled after nginx.ingress.kubernetes.io/canary: "true" is set

kundan2707 avatar Mar 03 '22 11:03 kundan2707

@tarun-asthana only change that i can observe is sequence of nginx.ingress.kubernetes.io/canary: "true" As per official documentation annotations to configure canary can be enabled after nginx.ingress.kubernetes.io/canary: "true" is set

@kundan2707 Do you mean the double quotes on true is the difference?

tarun-asthana avatar Mar 03 '22 21:03 tarun-asthana

@tarun-asthana i am asking change that i have observed which is sequence of annotations. nginx.ingress.kubernetes.io/canary: "true" comes first

kundan2707 avatar Mar 17 '22 09:03 kundan2707

I do the same, my canary is not working, apply canary-weight given to me an error

kubernetes.io/ingress.class: nginx nginx.ingress.kubernetes.io/canary: "true" nginx.ingress.kubernetes.io/canary-weight: "50"

<head><title>404 Not Found</title></head>
<body>
<center><h1>404 Not Found</h1></center>
<hr><center>nginx</center>
</body>
</html>

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: nginx-ingress
  namespace: ingress
  annotations:
    # kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/canary: "true"
    nginx.ingress.kubernetes.io/canary-weight: "50"
spec:
  ingressClassName: nginx
  rules:
  - host: webservice.com
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: web2
            port:
              number: 80
      - path: /web2
        pathType: Prefix
        backend:
          service:
            name: web2
            port:
              number: 80
      - path: /web3
        pathType: Prefix
        backend:
          service:
            name: web3
            port:
              number: 80

I add another annotation, but it was ok.

rthamrin avatar Apr 08 '22 23:04 rthamrin

What's the role of service-upstream annotation? I've observed it to be working fine with that annotation

tarun-asthana avatar Apr 10 '22 15:04 tarun-asthana

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar Jul 09 '22 15:07 k8s-triage-robot

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

k8s-triage-robot avatar Aug 08 '22 16:08 k8s-triage-robot

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Reopen this issue or PR with /reopen
  • Mark this issue or PR as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close

k8s-triage-robot avatar Sep 07 '22 16:09 k8s-triage-robot

@k8s-triage-robot: Closing this issue.

In response to this:

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Reopen this issue or PR with /reopen
  • Mark this issue or PR as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

k8s-ci-robot avatar Sep 07 '22 16:09 k8s-ci-robot