Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unable to drain k8s node running Istio components with PDB #12602

Open
jansmets opened this issue Mar 19, 2019 · 37 comments
Open

unable to drain k8s node running Istio components with PDB #12602

jansmets opened this issue Mar 19, 2019 · 37 comments
Labels
area/environments lifecycle/staleproof Indicates a PR or issue has been deemed to be immune from becoming stale and/or automatically closed
Milestone

Comments

@jansmets
Copy link

Deployed istio 1.1.0 RC with helm chart (not template)

I would like to drain out a specific node because it needs a reboot.
The PODs

Annotations:        scheduler.alpha.kubernetes.io/critical-pod:

prevents that.

error when evicting pod "istio-policy-d48655744-s8ggt" (will retry after 5s): Cannot evict pod as it would violate the pod's disruption budget.

(also note that annotation scheduler.alpha.kubernetes.io/critical-pod is deprecated and will be removed in k8s 1.14!)

@dwradcliffe
Copy link
Contributor

I don't think this is related to the critical-pod annotation, but instead the PodDisruptionBudget.

You can view with kubectl describe pdb istio-policy -n istio-system.
I'm guessing you only have 1 pilot pod running, and the PDB is preventing the eviction because that would violate the budget.

Try running 2 replicas of pilot.

@linsun
Copy link
Member

linsun commented Mar 21, 2019

agreed, try scale out istio-policy first before drain the node as PDB requires 1 replica to be alive.

@linsun
Copy link
Member

linsun commented Apr 24, 2019

@jansmets is this still an issue?

@Lysholm
Copy link
Contributor

Lysholm commented May 5, 2019

The default helm installs are set up with 1 replica and a PDB for several deployments / HPAs. This seems like a case of a bad default config. PDBs are a feature for HA deployments, and HA deployments imply 2+ replicas.

The reason this is bad is that it breaks kubectl drain. In itself not good but automatic node-pool upgrades may also fail or take unacceptably long to apply. Node-pools will automatically upscale but then may fail to downscale as well.

Don't know if this is a feature or a bug but it's not a great default config for istio installs. I would either remove the PDBs or increase default replicas to 2.

Affected deployments (spec.replicas = 1): certmanager, istio-galley
Affected HPA (spec.minReplicas = 1): istio-egressgateway, istio-ingressgateway, istio-policy, istio-telemetry, istio-pilot

@kinihun
Copy link

kinihun commented Aug 5, 2019

Is there any plan to resolve this issue. It's still a blocker when using such a tool like kured. It results in a node being effectively locked out of action almost indefinitely.

@johscheuer
Copy link
Member

We also ran into this issue and worked around it by setting the replicaCount for all components greater than 1.

Actually resolving this issue has some challenges from my which i'm not sure how to solve best:

We want to create a PodDisruptionBudget only in the following cases:

  • replicaCount is set to 1 or greater
  • When PodDisruptionBudget is activated obviously

but what if you don't set the replicaCount because you use the autoscaling feature with minReplicas: 1? Should the pdb created since there can be cases where more than 1 replica is available but if there is no load on your cluster you will have the same challenges as before.

Probably a quick win would be to allow setting the pdb behaviour on components e.g. you can globally activate pdb but deactivate if for specific components.

@linsun
Copy link
Member

linsun commented Oct 18, 2019

Think this is still a valid issue for the new installer/operator.

The resulting is we produce a production high availability profile that have multiple replicas and specifically targeted to resolve upgrade without down time prob. We don't want this to be a solution just for istio-policy as istio-policy is going away soon.

How does that sound @johscheuer @jansmets @dwradcliffe?

cc @howardjohn @sdake @ostromart

@Arnold1
Copy link

Arnold1 commented Nov 7, 2019

@dwradcliffe @linsun running in the same issue:

$ kops rolling-update cluster --yes
...
error when evicting pod "istio-policy-578bcb878f-2dmlw" (will retry after 5s): Cannot evict pod as it would violate the pod's disruption budget.
error when evicting pod "istio-galley-84749d54b7-24qrp" (will retry after 5s): Cannot evict pod as it would violate the pod's disruption budget.
error when evicting pod "istio-policy-578bcb878f-2dmlw" (will retry after 5s): Cannot evict pod as it would violate the pod's disruption budget.
error when evicting pod "istio-galley-84749d54b7-24qrp" (will retry after 5s): Cannot evict pod as it would violate the pod's disruption budget.
$ kubectl describe pdb istio-policy -n istio-system
Name:           istio-policy
Namespace:      istio-system
Min available:  1
Selector:       app=policy,istio=mixer,istio-mixer-type=policy,release=istio
Status:
    Allowed disruptions:  0
    Current:              1
    Desired:              1
    Total:                1
Events:                   <none>

what to do to fix it?

@vigohe
Copy link

vigohe commented Nov 18, 2019

@Arnold1 you need to add one more replica for istio-policy & istio-galley.

If you did install istio with helm you need to add the following lines to values.yaml

galley:
  enabled: true
  replicaCount: 2

mixer:
  policy:
    enabled: true
    replicaCount: 2

Then apply it:

helm upgrade --install istio istio.io/istio --namespace istio-system -f values.yaml

@colincoghill
Copy link

citadel has the same problem in istio 1.4, except you don't appear to be able to specify its replicaCount, that I can see.

@vigohe
Copy link

vigohe commented Nov 20, 2019

@colincoghill for citadel it's the security section.

values.yaml

security:
  enabled: true
  replicaCount: 2

@colincoghill
Copy link

aha, brilliant, that worked for me, thank you @vigohe

@Arnold1
Copy link

Arnold1 commented Dec 5, 2019

@colincoghill @vigohe can I use this values.yaml file for istio 1.4?

values.yaml:

galley:
    enabled: true
    replicaCount: 2

mixer:
  policy:
    enabled: true
    replicaCount: 2

security:
    enabled: true
    replicaCount: 2

@vigohe I get this error:

$ helm upgrade --install istio istio.io/istio --namespace istio-system -f values.yaml
Error: failed to download "istio.io/istio" (hint: running `helm repo update` may help)

@Arnold1
Copy link

Arnold1 commented Dec 5, 2019

what worked is:
cd istio-1.4.0
and than edit install/kubernetes/helm/istio/values.yaml:

  defaultPodDisruptionBudget:
    enabled: false

and than:

helm upgrade --install istio install/kubernetes/helm/istio --namespace istio-system -f install/kubernetes/helm/istio/values.yaml

is that the recomended way for istio 1.4?

@kovalyukm
Copy link

So, what is Istio recommended solution to correctly drain node with any istio component?

Istio 1.4.2 installed with istioctl has these values for prod (default) profile:

k get pdb -n istio-system
NAME MIN AVAILABLE MAX UNAVAILABLE ALLOWED DISRUPTIONS AGE
certmanager 1 N/A 0 12d
ingressgateway 1 N/A 0 12d
istio-citadel 1 N/A 0 12d
istio-galley 1 N/A 0 12d
istio-pilot 1 N/A 0 12d
istio-policy 1 N/A 0 12d
istio-sidecar-injector 1 N/A 0 12d
istio-telemetry 1 N/A 0 12d

ALLOWED DISRUPTIONS = 0 for all components.

Thanks!

@sazzle2611
Copy link

Hi all, I have this same issue only it is on a kubernetes cluster (v 17.2) with only 2 nodes, one master and one worker, meaning as pods are only scheduled on the worker then we can't get around this problem by autoscaling.

He don't need HA but it would be nice to be able to drain the node properly, is there any way to disable the pdb (and hpa) for the ingress gateways and istiod?

We are using istio 1.6 installed with istioctl and this is the current ingress gateway config but it still creates pdb

components:
ingressGateways:
- name: istio-ingressgateway
enabled: true
k8s:
replicaCount: 1
hpaSpec:
minReplicas: 1
maxReplicas: 1

If I remove the hpaSec then it sets a hpa with max replicas 5 which is definitely not what we want.

Thanks,
Sarah

@sdake sdake reopened this Sep 27, 2020
@sdake sdake modified the milestones: 1.7, 1.8 Sep 27, 2020
@sdake sdake added the lifecycle/staleproof Indicates a PR or issue has been deemed to be immune from becoming stale and/or automatically closed label Sep 27, 2020
@davidkarlsen
Copy link

This can be avoided with the following spec:

apiVersion: install.istio.io/v1alpha1
kind: IstioOperator
metadata:
  name: istio-controlplane
  namespace: istio-system
spec:
  addonComponents:
    kiali:
      enabled: true
    prometheus:
      enabled: false
    tracing:
      enabled: true
  components:
    cni:
      enabled: true
    ingressGateways:
    - enabled: true
      k8s:
        hpaSpec:
          minReplicas: 2
      name: istio-ingressgateway
    pilot:
      enabled: true
      k8s:
        hpaSpec:
          minReplicas: 2
  meshConfig:
    enablePrometheusMerge: true
  profile: default
  values:
    cni:
      excludeNamespaces:
      - istio-system
      - kube-system
      logLevel: info
    kiali:
      dashboard:
        grafanaURL: http:https://monitoring-grafana.monitoring.svc
      prometheusAddr: http:https://monitoring-prometheus-server.monitoring.svc

which should probablt be default (the hpa values)

@bianpengyuan
Copy link
Contributor

Related: #24000

@Vaccano
Copy link

Vaccano commented May 14, 2021

This can be avoided with the following spec:

apiVersion: install.istio.io/v1alpha1
kind: IstioOperator
metadata:
  name: istio-controlplane
  namespace: istio-system
spec:
  addonComponents:
    kiali:
      enabled: true
    prometheus:
      enabled: false
    tracing:
      enabled: true
  components:
    cni:
      enabled: true
    ingressGateways:
    - enabled: true
      k8s:
        hpaSpec:
          minReplicas: 2
      name: istio-ingressgateway
    pilot:
      enabled: true
      k8s:
        hpaSpec:
          minReplicas: 2
  meshConfig:
    enablePrometheusMerge: true
  profile: default
  values:
    cni:
      excludeNamespaces:
      - istio-system
      - kube-system
      logLevel: info
    kiali:
      dashboard:
        grafanaURL: http:https://monitoring-grafana.monitoring.svc
      prometheusAddr: http:https://monitoring-prometheus-server.monitoring.svc

which should probablt be default (the hpa values)

It is important to note that this solution only works if you installed Istio using the Istio Operator. (At least that was my experience.)

@Kostanos
Copy link

Kostanos commented Jun 7, 2022

Just scaling istiod deployment to 2 and after scaling it back to 1 worked for me.
Meanwhile the draining node is in cordoned state.
I'm using lens for it, but here is a kubectl:

kubectl cordon <your node to drain>
kubectl scale --replicas=2 deployemnt/istiod
# Make sure it was scaled, when you scale it back, it will remove pod from cordoned node
kubectl scale --replicas=1 deployment/istiod
kubectl drain <your node to drain>

PS. in my case, istiod was in separate node from other istio related services, and it worked.

@dozer75
Copy link

dozer75 commented Aug 31, 2022

@Kostanos suggestion helped me during the AKS outage yesterday due to the Ubuntu 18.04 issues to heal the cluster. In addition I had to run the same command on istio-ingressgateway as well.

apo-ger added a commit to apo-ger/manifests that referenced this issue Nov 22, 2022
Istio 1.6.0 generated manifests include some policy/v1
PodDisruptionBudget resources that we need to remove. See:
- istio/istio#12602
- istio/istio#24000

The current manifests utilize two "delete" patches:
- common/istio-1-16/istio-install/base/patches/remove-pdb.yaml
- common/istio-1-16/cluster-local-gateway/base/patches/remove-pdb.yaml

However these patches do not work with kustomize v3.2.0. The root
cause is that v3.2.0 doesn't have the appropriate openapi schema for
the policy/v1 API version resources. This is fixed in kustomize v4+.
See:
- kubernetes-sigs/kustomize#3694 (comment)
- kubernetes-sigs/kustomize#4495

Changes:
- We disable the delete patches until we upgrade to kustomize v4+.
  - tracked in: kubeflow#1797

- As a temporary workaraound we remove PodDisruptionBudget resources
  manually with yq before deploying Istio manifests.

- Update README file with instructions.

Refs: kubeflow#2325

Signed-off-by: Apostolos Gerakaris <[email protected]>
apo-ger added a commit to apo-ger/manifests that referenced this issue Nov 22, 2022
Istio 1.6.0 generated manifests include some policy/v1
PodDisruptionBudget resources that we need to remove. See:
- istio/istio#12602
- istio/istio#24000

The current manifests utilize two "delete" patches:
- common/istio-1-16/istio-install/base/patches/remove-pdb.yaml
- common/istio-1-16/cluster-local-gateway/base/patches/remove-pdb.yaml

However these patches do not work with kustomize v3.2.0. The root
cause is that v3.2.0 doesn't have the appropriate openapi schema for
the policy/v1 API version resources. This is fixed in kustomize v4+.
See:
- kubernetes-sigs/kustomize#3694 (comment)
- kubernetes-sigs/kustomize#4495

Changes:
- We disable the delete patches until we upgrade to kustomize v4+.
  - tracked in: kubeflow#1797

- As a temporary workaraound we remove PodDisruptionBudget resources
  manually with yq before deploying Istio manifests.

- Update README file with instructions.

Refs: kubeflow#2325

Signed-off-by: Apostolos Gerakaris <[email protected]>
apo-ger added a commit to apo-ger/manifests that referenced this issue Nov 22, 2022
Istio 1.6.0 generated manifests include some policy/v1
PodDisruptionBudget resources that we need to remove. See:
- istio/istio#12602
- istio/istio#24000

The current manifests utilize two "delete" patches:
- common/istio-1-16/istio-install/base/patches/remove-pdb.yaml
- common/istio-1-16/cluster-local-gateway/base/patches/remove-pdb.yaml

However these patches do not work with kustomize v3.2.0. The root
cause is that v3.2.0 doesn't have the appropriate openapi schema for
the policy/v1 API version resources. This is fixed in kustomize v4+.
See:
- kubernetes-sigs/kustomize#3694 (comment)
- kubernetes-sigs/kustomize#4495

Changes:
- We disable the delete patches until we upgrade to kustomize v4+.
  - tracked in: kubeflow#1797

- As a temporary workaraound we remove PodDisruptionBudget resources
  manually with yq before deploying Istio manifests.

- Update README file with instructions.

Refs: kubeflow#2325

Signed-off-by: Apostolos Gerakaris <[email protected]>
apo-ger added a commit to apo-ger/manifests that referenced this issue Nov 24, 2022
Istio 1.6.0 generated manifests include some policy/v1
PodDisruptionBudget resources that we need to remove. See:
- istio/istio#12602
- istio/istio#24000

The current manifests utilize two "delete" patches:
- common/istio-1-16/istio-install/base/patches/remove-pdb.yaml
- common/istio-1-16/cluster-local-gateway/base/patches/remove-pdb.yaml

However these patches do not work with kustomize v3.2.0. The root
cause is that v3.2.0 doesn't have the appropriate openapi schema for
the policy/v1 API version resources. This is fixed in kustomize v4+.
See:
- kubernetes-sigs/kustomize#3694 (comment)
- kubernetes-sigs/kustomize#4495

Changes:
- We disable the delete patches until we upgrade to kustomize v4+.
  - tracked in: kubeflow#1797

- As a temporary workaraound we remove PodDisruptionBudget resources
  manually with yq before deploying Istio manifests.

- Update README file with instructions.

Refs: kubeflow#2325

Signed-off-by: Apostolos Gerakaris <[email protected]>
google-oss-prow bot pushed a commit to kubeflow/manifests that referenced this issue Nov 24, 2022
* common: Add Istio v1.16.0 manifests

Signed-off-by: Apostolos Gerakaris <[email protected]>

* Update kustomization file in example to deploy istio-1-16

Signed-off-by: Apostolos Gerakaris <[email protected]>

* tests: Update install Istio GH action script

Use Istio 1.16 for testing

Signed-off-by: Apostolos Gerakaris <[email protected]>

* common: Remove PodDisruptionBudget resources for Istio

Istio 1.6.0 generated manifests include some policy/v1
PodDisruptionBudget resources that we need to remove. See:
- istio/istio#12602
- istio/istio#24000

The current manifests utilize two "delete" patches:
- common/istio-1-16/istio-install/base/patches/remove-pdb.yaml
- common/istio-1-16/cluster-local-gateway/base/patches/remove-pdb.yaml

However these patches do not work with kustomize v3.2.0. The root
cause is that v3.2.0 doesn't have the appropriate openapi schema for
the policy/v1 API version resources. This is fixed in kustomize v4+.
See:
- kubernetes-sigs/kustomize#3694 (comment)
- kubernetes-sigs/kustomize#4495

Changes:
- We disable the delete patches until we upgrade to kustomize v4+.
  - tracked in: #1797

- As a temporary workaraound we remove PodDisruptionBudget resources
  manually with yq before deploying Istio manifests.

- Update README file with instructions.

Refs: #2325

Signed-off-by: Apostolos Gerakaris <[email protected]>

* Update README

Use the --cluster-specific flag when generating Istio 1.16 manifests
for K8s-1.25. See:
* istio/istio#41220

Signed-off-by: Apostolos Gerakaris <[email protected]>

* tests: Update GH Action workflows

Trigger the workflows when the Istio version changes

Signed-off-by: Apostolos Gerakaris <[email protected]>

Signed-off-by: Apostolos Gerakaris <[email protected]>
@des1redState
Copy link

des1redState commented Feb 27, 2023

You can save yourself a command @Kostanos. Once you've cordoned your Node, use the kubectl rollout restart deployment/... command instead of manually scaling, which will essentially do the same thing (scale up to 2 Pods, wait for the 2nd to become Ready, then remove the initial Pod).

kevin85421 pushed a commit to juliusvonkohout/manifests that referenced this issue Feb 28, 2023
* common: Add Istio v1.16.0 manifests

Signed-off-by: Apostolos Gerakaris <[email protected]>

* Update kustomization file in example to deploy istio-1-16

Signed-off-by: Apostolos Gerakaris <[email protected]>

* tests: Update install Istio GH action script

Use Istio 1.16 for testing

Signed-off-by: Apostolos Gerakaris <[email protected]>

* common: Remove PodDisruptionBudget resources for Istio

Istio 1.6.0 generated manifests include some policy/v1
PodDisruptionBudget resources that we need to remove. See:
- istio/istio#12602
- istio/istio#24000

The current manifests utilize two "delete" patches:
- common/istio-1-16/istio-install/base/patches/remove-pdb.yaml
- common/istio-1-16/cluster-local-gateway/base/patches/remove-pdb.yaml

However these patches do not work with kustomize v3.2.0. The root
cause is that v3.2.0 doesn't have the appropriate openapi schema for
the policy/v1 API version resources. This is fixed in kustomize v4+.
See:
- kubernetes-sigs/kustomize#3694 (comment)
- kubernetes-sigs/kustomize#4495

Changes:
- We disable the delete patches until we upgrade to kustomize v4+.
  - tracked in: kubeflow#1797

- As a temporary workaraound we remove PodDisruptionBudget resources
  manually with yq before deploying Istio manifests.

- Update README file with instructions.

Refs: kubeflow#2325

Signed-off-by: Apostolos Gerakaris <[email protected]>

* Update README

Use the --cluster-specific flag when generating Istio 1.16 manifests
for K8s-1.25. See:
* istio/istio#41220

Signed-off-by: Apostolos Gerakaris <[email protected]>

* tests: Update GH Action workflows

Trigger the workflows when the Istio version changes

Signed-off-by: Apostolos Gerakaris <[email protected]>

Signed-off-by: Apostolos Gerakaris <[email protected]>
@howardjohn howardjohn changed the title unable to drain k8s node running istio-policy pod unable to drain k8s node running Istio components with PDB Apr 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/environments lifecycle/staleproof Indicates a PR or issue has been deemed to be immune from becoming stale and/or automatically closed
Projects
Status: P1
Development

Successfully merging a pull request may close this issue.