<p><strong>Environment</strong></p>
<ol>
<li>K8s</li>
</ol>
<pre><code>Client Version: version.Info{Major:&quot;1&quot;, Minor:&quot;22&quot;, GitVersion:&quot;v1.22.15&quot;, GitCommit:&quot;1d79bc3bcccfba7466c44cc2055d6e7442e140ea&quot;, GitTreeState:&quot;clean&quot;, BuildDate:&quot;2022-09-21T12:18:10Z&quot;, GoVersion:&quot;go1.16.15&quot;, Compiler:&quot;gc&quot;, Platform:&quot;linux/amd64&quot;}
Server Version: version.Info{Major:&quot;1&quot;, Minor:&quot;24+&quot;, GitVersion:&quot;v1.24.8-eks-ffeb93d&quot;, GitCommit:&quot;abb98ec0631dfe573ec5eae40dc48fd8f2017424&quot;, GitTreeState:&quot;clean&quot;, BuildDate:&quot;2022-11-29T18:45:03Z&quot;, GoVersion:&quot;go1.18.8&quot;, Compiler:&quot;gc&quot;, Platform:&quot;linux/amd64&quot;}
WARNING: version difference between client (1.22) and server (1.24) exceeds the supported minor version skew of +/-1
</code></pre>
<ol start="2">
<li>apiVersion: networking.k8s.io/v1</li>
</ol>
<pre><code>apiVersion: networking.k8s.io/v1
kind: Ingress
</code></pre>
<p><strong>Description</strong></p>
<p>After changed the apiVersion, I got an error</p>
<pre><code>current release manifest contains removed kubernetes api(s) for this kubernetes version and it is therefore unable to build the kubernetes objects for performing the diff. error from kubernetes: unable to recognize &quot;&quot;: no matches for kind &quot;Ingress&quot; in version &quot;extensions/v1&quot;
</code></pre>
<p>There are two questions confused me</p>
<ol>
<li>Even if I've changed the apiVersion to &quot;networking.k8s.io/v1&quot;, it still match api by &quot;extensions/v1&quot;</li>
<li>It's hard to know which field is needed to be modified because it's blank.</li>
</ol>
<p>Below is my template file</p>
<pre><code>apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: {{ .Release.Namespace }}-ingress
  namespace: {{ .Release.Namespace }}
  annotations:
    meta.helm.sh/release-name: ingress
    meta.helm.sh/release-namespace: {{ .Release.Namespace }}
    alb.ingress.kubernetes.io/scheme: internet-facing
    alb.ingress.kubernetes.io/listen-ports: {{ .Values.listenPorts | toJson | quote }}
    alb.ingress.kubernetes.io/certificate-arn: {{ .Values.certificateArn }}
    alb.ingress.kubernetes.io/healthcheck-path: /health-check
    alb.ingress.kubernetes.io/healthcheck-interval-seconds: &quot;30&quot;
    alb.ingress.kubernetes.io/healthcheck-timeout-seconds: &quot;5&quot;
    alb.ingress.kubernetes.io/ssl-policy: &quot;ELBSecurityPolicy-TLS-1-2-Ext-2018-06&quot;
    alb.ingress.kubernetes.io/load-balancer-attributes: deletion_protection.enabled={{ .Values.deleteProtection }},access_logs.s3.enabled={{ .Values.enabledAccessLog }},access_logs.s3.bucket=alb-access-log-s3-{{ .Release.Namespace }}
    # maintenance mode - api-playback # 
    alb.ingress.kubernetes.io/conditions.api-playback-maintenance-rule-1 : {{ .Values.maintenanceIpAddress1 | toJson | quote }}
    alb.ingress.kubernetes.io/conditions.api-playback-maintenance-rule-2 : {{ .Values.maintenanceIpAddress2 | toJson | quote }}
    alb.ingress.kubernetes.io/conditions.api-playback-maintenance-rule-3 : {{ .Values.maintenanceIpAddress3 | toJson | quote }}
    alb.ingress.kubernetes.io/actions.api-playback-maintenance-rule-1 : {{ .Values.playbackMaintenanceAnnotationCode  | toJson | quote }}
    alb.ingress.kubernetes.io/actions.api-playback-maintenance-rule-2 : {{ .Values.playbackMaintenanceAnnotationCode  | toJson | quote }}
    alb.ingress.kubernetes.io/actions.api-playback-maintenance-rule-3 : {{ .Values.playbackMaintenanceAnnotationCode  | toJson | quote }}
    
    # maintenance mode - api-cms #
    alb.ingress.kubernetes.io/conditions.api-cms-maintenance-rule-1 : {{ .Values.maintenanceIpAddress1 | toJson | quote }}
    alb.ingress.kubernetes.io/conditions.api-cms-maintenance-rule-2 : {{ .Values.maintenanceIpAddress2 | toJson | quote }}
    alb.ingress.kubernetes.io/conditions.api-cms-maintenance-rule-3 : {{ .Values.maintenanceIpAddress3 | toJson | quote }}
    alb.ingress.kubernetes.io/actions.api-cms-maintenance-rule-1 : {{ .Values.cmsMaintenanceAnnotationCode  | toJson | quote  }}
    alb.ingress.kubernetes.io/actions.api-cms-maintenance-rule-2 : {{ .Values.cmsMaintenanceAnnotationCode  | toJson | quote  }}
    alb.ingress.kubernetes.io/actions.api-cms-maintenance-rule-3 : {{ .Values.cmsMaintenanceAnnotationCode  | toJson | quote }}

    # maintenance mode - api-client #

    alb.ingress.kubernetes.io/conditions.api-client-maintenance-rule-1 : {{ .Values.maintenanceIpAddress1 | toJson | quote }}
    alb.ingress.kubernetes.io/conditions.api-client-maintenance-rule-2 : {{ .Values.maintenanceIpAddress2 | toJson | quote }}
    alb.ingress.kubernetes.io/conditions.api-client-maintenance-rule-3 : {{ .Values.maintenanceIpAddress3 | toJson | quote }}
    alb.ingress.kubernetes.io/actions.api-client-maintenance-rule-1 : {{ .Values.clientMaintenanceAnnotationCode  | toJson | quote  }}
    alb.ingress.kubernetes.io/actions.api-client-maintenance-rule-2 : {{ .Values.clientMaintenanceAnnotationCode  | toJson | quote  }}
    alb.ingress.kubernetes.io/actions.api-client-maintenance-rule-3 : {{ .Values.clientMaintenanceAnnotationCode  | toJson | quote }}

    alb.ingress.kubernetes.io/actions.maintenance-503: &gt;
        {&quot;type&quot;:&quot;fixed-response&quot;,&quot;fixedResponseConfig&quot;:{&quot;contentType&quot;:&quot;text/plain&quot;,&quot;statusCode&quot;:&quot;503&quot;,&quot;messageBody&quot;:&quot;maintenance mode&quot;}}

  labels:
    app.kubernetes.io/name: {{ .Release.Namespace }}-ingress
    app.kubernetes.io/managed-by: {{ .Release.Service }}
    app.kubernetes.io/instance: {{ .Release.Name }}

spec:
  rules:
  # maintenance rules
  {{- $inMaintenanceMode := .Values.inMaintenanceMode  -}}
  {{- if $inMaintenanceMode }}
  {{- $dn := .Values.dn -}}
  {{- $hasDN := .Values.hasDN  -}}
  {{- range .Values.maintenanceRules }}
  {{- if $hasDN }}
  - host: {{ .hostPrefix }}.{{ $dn }}
    http:
  {{- else }}
  - http:
  {{- end }}
      paths:
      {{- range .paths }}
      - path: {{ .path }}
        pathType: Prefix
        backend:
          service:
            name: {{ .serviceName }}
            port:
              name: use-annotation
      {{- end }}
  {{- end }}
  # if not inMaintenanceMode
  {{- else }}
  # default rules
  {{- $dn := .Values.dn -}}
  {{- $hasDN := .Values.hasDN  -}}
  {{- range .Values.rules }}
  {{- if $hasDN }}
  - host: {{ .hostPrefix }}.{{ $dn }}
    http:
  {{- else }}
  - http:
  {{- end }}
      paths:
      {{- range .paths }}
      - path: {{ .path }}
        pathType: Prefix
        backend:
          service:
            name: {{ .serviceName }}
            port: 
              number: {{ .servicePort }}
      {{- end }}
  {{- end }}
  {{- end }}
</code></pre>
<p>Deploy without the error</p>

pinyu lin
<p>It's due to API version mismatch, quick approach would be <strong>uninstall</strong> and <strong>re-install</strong> the <strong>helm chart</strong> for <strong>Dev</strong> environment if 2-3 min of <strong>downtime</strong> is fine for you.</p>
<p>You can use this <strong>helm plugin</strong> to get the idea about the <strong>deprecated the API</strong> : <a href="https://github.com/helm/helm-mapkubeapis" rel="nofollow noreferrer">https://github.com/helm/helm-mapkubeapis</a></p>
<p><strong>Option 2</strong> :</p>
<p>You can with suggested option to edit first the configmap/secret based on the backed</p>
<pre><code>kubectl get secret -l owner=helm,status=deployed,name=&lt;release_name&gt; --namespace &lt;release_namespace&gt; | awk '{print $1}' | grep -v NAME

kubectl get secret &lt;release_secret_name&gt; -n &lt;release_namespace&gt; -o yaml &gt; release.yaml

cp release.yaml release.bak

cat release.yaml | grep -oP '(?&lt;=release: ).*' | base64 -d | base64 -d | gzip -d &gt; release.data.decoded

cat release.data.decoded | gzip | base64 | base64

kubectl apply -f release.yaml -n &lt;release_namespace&gt;
</code></pre>
<p>Ref doc : <a href="https://helm.sh/docs/topics/kubernetes_apis/#updating-api-versions-of-a-release-manifest" rel="nofollow noreferrer">https://helm.sh/docs/topics/kubernetes_apis/#updating-api-versions-of-a-release-manifest</a></p>
