kubepug icon indicating copy to clipboard operation
kubepug copied to clipboard

Deprecation warning for ingress in extensions/v1beta1 while it was created using the networking.k8s.io/v1 API

Open jcmontigny-fox opened this issue 3 years ago • 10 comments

Description I am running Kubernetes v1.21 on AWS with the control plane managed by the EKS service. I installed Grafana with a manifest that defines an Ingress using the networking.k8s.io/v1 API. Ingresses are then implemented as an Application Load Balancer (ALB) in AWS by the aws-load-balancer-controller deployment. I am running v2.4.0 of that deployment, which is the latest version.

Expected behaviour Running the deprecations plugin should not find that Ingress to be deprecated.

Setup Kubernetes version: v1.21.5 Deprecations module version: v1.3.2 Grafana chart: official helm chart repo and github source files v6.17.10 helm: v3.5.1

Deprecations Plugin output

$ kubectl deprecations --context mycontext --k8s-version v1.21.5
W0222 16:15:18.147687   22639 warnings.go:70] extensions/v1beta1 Ingress is deprecated in v1.14+, unavailable in v1.22+; use networking.k8s.io/v1 Ingress

RESULTS:
Deprecated APIs:

Ingress found in extensions/v1beta1
	 ├─ Ingress is a collection of rules that allow inbound connections to reach the endpoints defined by a backend. An Ingress can be configured to give services externally-reachable urls, load balance traffic, terminate SSL, offer name based virtual hosting etc. DEPRECATED - This group version of Ingress is deprecated by networking.k8s.io/v1beta1 Ingress. See the release notes for more information.
		-> OBJECT: shared-tools-grafana namespace: grafana 

Manifest file for Ingress Full source Pertinent info only:

{{- if .Values.ingress.enabled -}}
[...]
apiVersion: {{ include "grafana.ingress.apiVersion" . }}
kind: Ingress
[...]

In our values, we set grafana.ingress.apiVersion to networking.k8s.io/v1

Yaml output of Ingress No extensions/v1beta1 API is reported in here.

$ kubectl get ingress shared-tools-grafana -n grafana -o yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    alb.ingress.kubernetes.io/actions.ssl-redirect: '{"Type": "redirect", "RedirectConfig":
      { "Protocol": "HTTPS", "Port": "443", "StatusCode": "HTTP_301"}}'
    alb.ingress.kubernetes.io/certificate-arn: arn:aws:acm:eu-central-1:REDACTED:certificate/REDACTED
    alb.ingress.kubernetes.io/healthcheck-path: /
    alb.ingress.kubernetes.io/listen-ports: '[{"HTTP": 80}, {"HTTPS": 443}]'
    alb.ingress.kubernetes.io/scheme: internal
    alb.ingress.kubernetes.io/tags: Stack=Monitoring,Environment=sandbox,Region=eu-central-1
    alb.ingress.kubernetes.io/target-type: ip
    kubernetes.io/ingress.class: alb
    meta.helm.sh/release-name: shared-tools
    meta.helm.sh/release-namespace: default
  creationTimestamp: "2022-02-22T16:16:03Z"
  finalizers:
  - ingress.k8s.aws/resources
  generation: 1
  labels:
    app.kubernetes.io/instance: shared-tools
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/name: grafana
    app.kubernetes.io/version: 8.2.5
    helm.sh/chart: grafana-6.17.10
  managedFields:
  - apiVersion: networking.k8s.io/v1
    fieldsType: FieldsV1
    fieldsV1:
      f:metadata:
        f:annotations:
          .: {}
          f:alb.ingress.kubernetes.io/actions.ssl-redirect: {}
          f:alb.ingress.kubernetes.io/certificate-arn: {}
          f:alb.ingress.kubernetes.io/healthcheck-path: {}
          f:alb.ingress.kubernetes.io/listen-ports: {}
          f:alb.ingress.kubernetes.io/scheme: {}
          f:alb.ingress.kubernetes.io/tags: {}
          f:alb.ingress.kubernetes.io/target-type: {}
          f:kubernetes.io/ingress.class: {}
          f:meta.helm.sh/release-name: {}
          f:meta.helm.sh/release-namespace: {}
        f:labels:
          .: {}
          f:app.kubernetes.io/instance: {}
          f:app.kubernetes.io/managed-by: {}
          f:app.kubernetes.io/name: {}
          f:app.kubernetes.io/version: {}
          f:helm.sh/chart: {}
      f:spec:
        f:rules: {}
    manager: helm
    operation: Update
    time: "2022-02-22T16:16:03Z"
  - apiVersion: networking.k8s.io/v1
    fieldsType: FieldsV1
    fieldsV1:
      f:metadata:
        f:finalizers:
          .: {}
          v:"ingress.k8s.aws/resources": {}
      f:status:
        f:loadBalancer:
          f:ingress: {}
    manager: controller
    operation: Update
    time: "2022-02-22T16:16:07Z"
  name: shared-tools-grafana
  namespace: grafana
  resourceVersion: "53785142"
  uid: REDACTED
spec:
  rules:
  - host: grafana.internal.REDACTED
    http:
      paths:
      - backend:
          service:
            name: shared-tools-grafana
            port:
              number: 80
        path: /
        pathType: Prefix
status:
  loadBalancer:
    ingress:
    - hostname: internal-k8s-grafana-sharedto-REDACTED-REDACTED.eu-central-1.elb.amazonaws.com

jcmontigny-fox avatar Feb 22 '22 16:02 jcmontigny-fox

An idea that just crossed my mind: could it be that the go library your use to connect to the cluster is an outdated version that requests Ingresses using the former networking.k8s.io/v1beta1 api, then your code receives it using that api and finds it deprecated ?

jcmontigny-fox avatar Feb 23 '22 09:02 jcmontigny-fox

I have the same problem, got "Ingress found in extensions/v1beta1" but actually there is "networking.k8s.io/v1" used. This is when I use kubepug on Windows. But in Linux all is ok (different AKS cluster). Maybe problem with Windows binary?

bartwitkowski avatar Mar 02 '22 21:03 bartwitkowski

Ah right, I did not mention it but I was using MacOS.
I just tried on Linux (ubuntu 20.04 if that matters) and it gives me the same result as described.

jcmontigny-fox avatar Mar 04 '22 13:03 jcmontigny-fox

I just installed kubepug and encountering the same issue, it's identifying all of the ingresses currently in my cluster. When I do a kubectl get ingress I do not see any with extensions/v1beta1 listed. On my end, running microk8s v1.21.9 on Ubuntu 20.04.4, kubepug v1.3.2.

taintedkernel avatar Mar 04 '22 18:03 taintedkernel

I have the same issue on MacOS.

aleksanyan avatar Mar 29 '22 10:03 aleksanyan

I did the following changes, and eventually it works for me.

  • upgraded k8s to 1.22.6
  • upgraded go from ~1.7 to 1.8
  • reinstalled kubepug (with krew)

aleksanyan avatar Mar 29 '22 11:03 aleksanyan

I'm also having this issue when connecting to a 1.21 EKS cluster from my Linux machine (Fedora) using kubepug v1.3.3. Any suggestions?

$ kubectl version
Client Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.9", GitCommit:"b631974d68ac5045e076c86a5c66fba6f128dc72", GitTreeState:"clean", BuildDate:"2022-01-19T17:51:12Z", GoVersion:"go1.16.12", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"21+", GitVersion:"v1.21.5-eks-bc4871b", GitCommit:"5236faf39f1b7a7dabea8df12726f25608131aa9", GitTreeState:"clean", BuildDate:"2021-10-29T23:32:16Z", GoVersion:"go1.16.8", Compiler:"gc", Platform:"linux/amd64"}
$ kubectl krew list
PLUGIN        VERSION
deprecations  v1.3.3
krew          v0.4.3

jeffqumata avatar Apr 05 '22 14:04 jeffqumata

from the kubernetes API perspective i think it was expected as per explained here. you can test it by using kubectl it self in k8s version 1.21

❯ kubectl get ingresses.v1beta1.extensions -A | head -n 2
Warning: extensions/v1beta1 Ingress is deprecated in v1.14+, unavailable in v1.22+; use networking.k8s.io/v1 Ingress
NAMESPACE   NAME                        CLASS          HOSTS                        ADDRESS         PORTS     AGE
gitlab      gitlab-minio                gitlab-nginx   minio.172.17.0.1.nip.io      10.96.151.126   80, 443   92d

❯ kubectl get ing/gitlab-minio -n gitlab -o jsonpath='{.apiVersion}'
networking.k8s.io/v1

i just skip for ingress detection since it will resolved in 1.22 as mentioned before.

I did the following changes, and eventually it works for me.

* upgraded k8s to `1.22.6`

* upgraded `go` from ~1.7 to 1.8

* reinstalled kubepug (with krew)

iomarmochtar avatar Jun 09 '22 03:06 iomarmochtar

i found the keywords under the annotations managedFields. do not understand why the plugin would check that

marafa-sugarcrm avatar Jun 29 '22 09:06 marafa-sugarcrm

How skip check extensions/v1beta1 ?

patsevanton avatar Sep 21 '22 10:09 patsevanton

After updating deprecations plugin via krew to v1.4.0 issue have been gone and Ingresses are no longer listed.

Upgrades available for installed plugins: * deprecations v1.3.4 -> v1.4.0

elvinasp avatar Jan 24 '23 07:01 elvinasp

After updating deprecations plugin via krew to v1.4.0 issue have been gone and Ingresses are no longer listed.

Just for the record: Using version v1.4.0 the issue still exists for us.

0xErnie avatar Feb 01 '23 13:02 0xErnie

@0xErnie can you please point me to how to reproduce it?

Is it a Kubernetes v1.21, and you run Kubepug against it for what target version?

Thanks!

rikatz avatar Jul 04 '23 20:07 rikatz

ok, found the problem, fixes coming next :)

rikatz avatar Jul 04 '23 20:07 rikatz

fixed in https://github.com/rikatz/kubepug/pull/403/commits/a3ce8c88934bf0af510b399e6a779c8a794851cc

rikatz avatar Jul 04 '23 21:07 rikatz

Fixed on #403, please reopen here or let me know if it is not working. The next release (v1.5.0-alpha.1) will contain the fix.

Thanks for using the project :)

rikatz avatar Jul 04 '23 21:07 rikatz