kubernetes / autoscaler

Autoscaling components for Kubernetes
Apache License 2.0
8.11k stars 3.98k forks source link

VPA | fail to get pod controller #7473

Closed Rafael-Schippers closed 2 weeks ago

Rafael-Schippers commented 2 weeks ago

Which component are you using?: vertical-pod-autoscaler

What version of the component are you using?:

Component version: 1.2

What k8s version are you using (kubectl version)?: Client Version: v1.31.2 Kustomize Version: v5.4.2 Server Version: v1.30.4+rke2r1

kubectl version Output
$ kubectl version

What environment is this in?: On prem Rancher created cluster, 3-node cluster with RKE2

What did you expect to happen?: For the verticalpodautoscaler resources being applied to the pods

What happened instead?: The verticalpodautoscaler resources get created but not applied to the pods

How to reproduce it (as minimally and precisely as possible):

Anything else we need to know?: kubectl --namespace=kube-system logs vpa-updater-59469d986c-tmhbt | grep -e '^E[0-9]{4}'

E1107 13:58:21.479450       1 api.go:153] fail to get pod controller: pod=kube-system/kube-proxy-srv-rke-246 err=Unhandled targetRef v1 / Node / srv-rke-246, last error node is not a valid owner
E1107 13:58:21.479625       1 api.go:153] fail to get pod controller: pod=kube-system/kube-proxy-srv-rke-247 err=Unhandled targetRef v1 / Node / srv-rke-247, last error node is not a valid owner

kubectl --namespace=kube-system get pods|grep vpa

vpa-admission-controller-588f76d665-5rt27              1/1     Running   0               2d22h
vpa-recommender-86b94bfb5b-mbsf4                       1/1     Running   0               2d22h
vpa-updater-59469d986c-tmhbt                           1/1     Running   0               2d22h

kubectl get customresourcedefinition | grep verticalpodautoscalers verticalpodautoscalers.autoscaling.k8s.io 2024-10-02T15:33:47Z

kubectl get vpa

NAME                    MODE   CPU   MEM       PROVIDED   AGE
vpa-hallintaa-staging   Auto   12m   131072k   True       35d

kubectl describe pod hallintaa-staging-77c8685cf-cv8wt

    Limits:
      cpu:     240m
      memory:  320Mi
    Requests:
      cpu:     12m
      memory:  131072k
adrianmoisey commented 2 weeks ago

/area vertical-pod-autoscaler

adrianmoisey commented 2 weeks ago

Can you add more details about the vpa-hallintaa-staging VPA and the controller for hallintaa-staging?

kubectl get vpa vpa-hallintaa-staging -o yaml
kubectl get deployment hallintaa-staging -o yaml
adrianmoisey commented 2 weeks ago

Also, the pod you showed did get the recommendations from the VPA, it's under the "requests" section

Rafael-Schippers commented 2 weeks ago

Sure here is the output of both commands.

kubectl get vpa vpa-hallintaa-staging -o yaml:

apiVersion: autoscaling.k8s.io/v1
kind: VerticalPodAutoscaler
metadata:
  annotations:
    kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"autoscaling.k8s.io/v1","kind":"VerticalPodAutoscaler","metadata":{"annotations":{},"name":"vpa-hallintaa-staging","namespace":"hallintaa-staging"},"spec":{"targetRef":{"apiVersion":"apps/v1","kind":"Deployment","name":"hallintaa-staging"},"updatePolicy":{"updateMode":"Auto"}}}
  creationTimestamp: "2024-10-03T13:49:20Z"
  generation: 1
  name: vpa-hallintaa-staging
  namespace: hallintaa-staging
  resourceVersion: "144440235"
  uid: 9070da0f-9b92-4103-9a44-22049895fe24
spec:
  targetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: hallintaa-staging
  updatePolicy:
    updateMode: Auto
status:
  conditions:
  - lastTransitionTime: "2024-10-03T13:49:56Z"
    status: "True"
    type: RecommendationProvided
  recommendation:
    containerRecommendations:
    - containerName: nginx
      lowerBound:
        cpu: 12m
        memory: 131072k
      target:
        cpu: 12m
        memory: 131072k
      uncappedTarget:
        cpu: 12m
        memory: 131072k
      upperBound:
        cpu: 12m
        memory: 131072k
    - containerName: php
      lowerBound:
        cpu: 12m
        memory: 131072k
      target:
        cpu: 12m
        memory: 131072k
      uncappedTarget:
        cpu: 12m
        memory: 131072k
      upperBound:
        cpu: 12m
        memory: 131072k

kubectl get deployment hallintaa-staging -o yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    deployment.kubernetes.io/revision: "10"
    field.cattle.io/publicEndpoints: '[{"addresses":["10.200.223.246","10.200.223.247","10.200.223.249"],"port":443,"protocol":"HTTPS","serviceName":"hallintaa-staging:service-hallintaa-staging","ingressName":"hallintaa-staging:ingress-hallintaa-staging","hostname":"hallintaa.staging.ap.be","path":"/","allNodes":false}]'
    kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"apps/v1","kind":"Deployment","metadata":{"annotations":{},"labels":{"app":"hallintaa-staging"},"name":"hallintaa-staging","namespace":"hallintaa-staging"},"spec":{"replicas":2,"selector":{"matchLabels":{"app":"hallintaa-staging"}},"template":{"metadata":{"labels":{"app":"hallintaa-staging"}},"spec":{"containers":[{"image":"nginxinc/nginx-unprivileged:alpine","imagePullPolicy":"IfNotPresent","name":"nginx","ports":[{"containerPort":8080}],"resources":{"limits":{"cpu":"500m","memory":"400Mi"},"requests":{"cpu":"100m","memory":"200Mi"}},"volumeMounts":[{"mountPath":"/var/www/html","name":"code"},{"mountPath":"/etc/nginx/conf.d/default.conf","name":"nginx-config-volume","subPath":"nginx.conf"},{"mountPath":"/socket","name":"socket"}]},{"envFrom":[{"configMapRef":{"name":"settings-hallintaa-staging"}},{"secretRef":{"name":"secrets-hallintaa-staging"}}],"<redacted>/php:af8a269d","imagePullPolicy":"Always","name":"php","resources":{"limits":{"cpu":"2000m","memory":"512Mi"},"requests":{"cpu":"100m","memory":"200Mi"}},"volumeMounts":[{"mountPath":"/var/www/html","name":"code"},{"mountPath":"/socket","name":"socket"}]}],"imagePullSecrets":[{"name":"<redacted>"}],"initContainers":[{"command":["sh","-c","cp -r /source/. /var/www/html/"],"image":"<redacted>hallintaa:af8a269d","imagePullPolicy":"Always","name":"init","volumeMounts":[{"mountPath":"/var/www/html","name":"code"}]}],"volumes":[{"emptyDir":{},"name":"code"},{"emptyDir":{},"name":"socket"},{"configMap":{"name":"nginx-config-hallintaa-staging"},"name":"nginx-config-volume"}]}}}}
  creationTimestamp: "2024-09-10T07:57:56Z"
  generation: 30
  labels:
    app: hallintaa-staging
  name: hallintaa-staging
  namespace: hallintaa-staging
  resourceVersion: "158632584"
  uid: 12584899-6d4f-4b6b-8fc3-af8824c8475d
spec:
  progressDeadlineSeconds: 600
  replicas: 2
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app: hallintaa-staging
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      creationTimestamp: null
      labels:
        app: hallintaa-staging
    spec:
      containers:
      - image: nginxinc/nginx-unprivileged:alpine
        imagePullPolicy: IfNotPresent
        name: nginx
        ports:
        - containerPort: 8080
          protocol: TCP
        resources:
          limits:
            cpu: 500m
            memory: 400Mi
          requests:
            cpu: 100m
            memory: 200Mi
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - mountPath: /var/www/html
          name: code
        - mountPath: /etc/nginx/conf.d/default.conf
          name: nginx-config-volume
          subPath: nginx.conf
        - mountPath: /socket
          name: socket
      - envFrom:
        - configMapRef:
            name: settings-hallintaa-staging
        - secretRef:
            name: secrets-hallintaa-staging
        image: <redacted>
        imagePullPolicy: Always
        name: php
        resources:
          limits:
            cpu: "2"
            memory: 512Mi
          requests:
            cpu: 100m
            memory: 200Mi
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - mountPath: /var/www/html
          name: code
        - mountPath: /socket
          name: socket
      dnsPolicy: ClusterFirst
      imagePullSecrets:
      - name: <redacted>
      initContainers:
      - command:
        - sh
        - -c
        - cp -r /source/. /var/www/html/
        image: <redacted>
        imagePullPolicy: Always
        name: init
        resources: {}
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - mountPath: /var/www/html
          name: code
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      terminationGracePeriodSeconds: 30
      volumes:
      - emptyDir: {}
        name: code
      - emptyDir: {}
        name: socket
      - configMap:
          defaultMode: 420
          name: nginx-config-hallintaa-staging
        name: nginx-config-volume
status:
  availableReplicas: 2
  conditions:
  - lastTransitionTime: "2024-09-10T09:12:41Z"
    lastUpdateTime: "2024-10-03T13:56:15Z"
    message: ReplicaSet "hallintaa-staging-77c8685cf" has successfully progressed.
    reason: NewReplicaSetAvailable
    status: "True"
    type: Progressing
  - lastTransitionTime: "2024-11-04T15:32:55Z"
    lastUpdateTime: "2024-11-04T15:32:55Z"
    message: Deployment has minimum availability.
    reason: MinimumReplicasAvailable
    status: "True"
    type: Available
  observedGeneration: 30
  readyReplicas: 2
  replicas: 2
  updatedReplicas: 2
adrianmoisey commented 2 weeks ago

Everything looks like it's configured correctly, and you are getting requests from the VPA, see:

NAME                    MODE   CPU   MEM       PROVIDED   AGE
vpa-hallintaa-staging   Auto   12m   131072k   True       35d

and

    Limits:
      cpu:     240m
      memory:  320Mi
    Requests:
      cpu:     12m
      memory:  131072k

The VPA's primary concern is to set requests.

Rafael-Schippers commented 2 weeks ago

Your right that was an bad example. I wrongly assumed they were all broken so I picked one at random. Was checking through some other workloads and it seems that this one is not working at least.

kubectl get vpa vpa-student-staging -o yaml

apiVersion: autoscaling.k8s.io/v1
kind: VerticalPodAutoscaler
metadata:
  annotations:
    kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"autoscaling.k8s.io/v1","kind":"VerticalPodAutoscaler","metadata":{"annotations":{},"name":"vpa-student-staging","namespace":"dev-intranet-student"},"spec":{"targetRef":{"apiVersion":"apps/v1","kind":"Deployment","name":"student-staging"},"updatePolicy":{"updateMode":"Auto"}}}
  creationTimestamp: "2024-11-05T14:55:10Z"
  generation: 1
  name: vpa-student-staging
  namespace: dev-intranet-student
  resourceVersion: "159011325"
  uid: bdcd5b3f-c64b-4fd0-944b-e6c3aa1e89cf
spec:
  targetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: student-staging
  updatePolicy:
    updateMode: Auto
status:
  conditions:
  - lastTransitionTime: "2024-11-05T14:55:34Z"
    status: "True"
    type: RecommendationProvided
  recommendation:
    containerRecommendations:
    - containerName: nginx
      lowerBound:
        cpu: 12m
        memory: 131072k
      target:
        cpu: 12m
        memory: 131072k
      uncappedTarget:
        cpu: 12m
        memory: 131072k
      upperBound:
        cpu: 13m
        memory: 131072k
    - containerName: php
      lowerBound:
        cpu: 12m
        memory: 131072k
      target:
        cpu: 12m
        memory: 131072k
      uncappedTarget:
        cpu: 12m
        memory: 131072k
      upperBound:
        cpu: 13m
        memory: 131072k

kubectl get deployment student-staging -o yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    deployment.kubernetes.io/revision: "1"
    field.cattle.io/publicEndpoints: '[{"addresses":["10.200.223.246","10.200.223.247","10.200.223.249"],"port":443,"protocol":"HTTPS","serviceName":"dev-intranet-student:service-student-staging","ingressName":"dev-intranet-student:ingress-student-staging","hostname":"student.dev.ap.be","path":"/","allNodes":false}]'
    kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"apps/v1","kind":"Deployment","metadata":{"annotations":{},"labels":{"app":"student-staging"},"name":"student-staging","namespace":"dev-intranet-student"},"spec":{"replicas":1,"selector":{"matchLabels":{"app":"student-staging"}},"template":{"metadata":{"labels":{"app":"student-staging"}},"spec":{"containers":[{"image":"nginxinc/nginx-unprivileged:alpine","imagePullPolicy":"IfNotPresent","name":"nginx","ports":[{"containerPort":8080}],"resources":{"limits":{"cpu":"500m","memory":"384Mi"},"requests":{"cpu":"250m","memory":"256Mi"}},"volumeMounts":[{"mountPath":"/var/www/html","name":"code"},{"mountPath":"/var/www/html/web/sites/default/files","name":"files"},{"mountPath":"/etc/nginx/conf.d/default.conf","name":"nginx-config-volume","subPath":"nginx.conf"},{"mountPath":"/socket","name":"socket"}]},{"envFrom":[{"configMapRef":{"name":"settings-student-staging"}},{"secretRef":{"name":"secrets-student-staging"}}],"image":"<redacted>","imagePullPolicy":"Always","name":"php","resources":{"limits":{"memory":"4096Mi"},"requests":{"cpu":"1000m","memory":"2048Mi"}},"volumeMounts":[{"mountPath":"/var/www/html","name":"code"},{"mountPath":"/socket","name":"socket"},{"mountPath":"/var/www/html/web/sites/default/files","name":"files"}]}],"imagePullSecrets":[{"name":"ap-gitlab-registry"}],"initContainers":[{"envFrom":[{"configMapRef":{"name":"settings-student-staging"}},{"secretRef":{"name":"secrets-student-staging"}}],"image":"<redacted>","imagePullPolicy":"Always","name":"init1","volumeMounts":[{"mountPath":"/var/www/html","name":"code"},{"mountPath":"/var/www/html/web/sites/default/files","name":"files"}]},{"command":["/bin/sh","-c","echo \"Init:  download webform libraries, import config (drush cim), cache rebuild (drush cr)\";\nexport http_proxy=\"<redacted>\";\nexport https_proxy=\"<redacted>\";\nprintenv | grep -i proxy\nvendor/bin/drush webform:libraries:download;\nvendor/bin/drush updb;\nvendor/bin/drush cim;\nvendor/bin/drush cr;\n#sleep 100;\n"],"envFrom":[{"configMapRef":{"name":"settings-student-staging"}},{"secretRef":{"name":"secrets-student-staging"}}],"image":"registry.git.ap.be/k8s/viavictor/intranet/ap-student-d10/php:400fca28","imagePullPolicy":"Always","name":"init2","resources":{"limits":{"cpu":"2000m","memory":"2048Mi"},"requests":{"cpu":"700m","memory":"384Mi"}},"securityContext":{"allowPrivilegeEscalation":false,"runAsUser":0},"volumeMounts":[{"mountPath":"/var/www/html","name":"code"},{"mountPath":"/socket","name":"socket"},{"mountPath":"/var/www/html/web/sites/default/files","name":"files"}]}],"volumes":[{"emptyDir":{},"name":"code"},{"emptyDir":{},"name":"socket"},{"configMap":{"name":"nginx-config-student-staging"},"name":"nginx-config-volume"},{"name":"files","persistentVolumeClaim":{"claimName":"pvclaim-student-staging"}}]}}}}
  creationTimestamp: "2024-10-18T12:35:25Z"
  generation: 14
  labels:
    app: student-staging
  name: student-staging
  namespace: dev-intranet-student
  resourceVersion: "158632555"
  uid: 0bc64a79-3dbe-4278-98e4-17ed7ff0d3f7
spec:
  progressDeadlineSeconds: 600
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app: student-staging
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      creationTimestamp: null
      labels:
        app: student-staging
    spec:
      containers:
      - image: nginxinc/nginx-unprivileged:alpine
        imagePullPolicy: IfNotPresent
        name: nginx
        ports:
        - containerPort: 8080
          protocol: TCP
        resources:
          limits:
            cpu: 500m
            memory: 384Mi
          requests:
            cpu: 250m
            memory: 256Mi
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - mountPath: /var/www/html
          name: code
        - mountPath: /var/www/html/web/sites/default/files
          name: files
        - mountPath: /etc/nginx/conf.d/default.conf
          name: nginx-config-volume
          subPath: nginx.conf
        - mountPath: /socket
          name: socket
      - envFrom:
        - configMapRef:
            name: settings-student-staging
        - secretRef:
            name: secrets-student-staging
        image: <redacted>
        imagePullPolicy: Always
        name: php
        resources:
          limits:
            memory: 4Gi
          requests:
            cpu: "1"
            memory: 2Gi
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - mountPath: /var/www/html
          name: code
        - mountPath: /socket
          name: socket
        - mountPath: /var/www/html/web/sites/default/files
          name: files
      dnsPolicy: ClusterFirst
      imagePullSecrets:
      - name: ap-gitlab-registry
      initContainers:
      - envFrom:
        - configMapRef:
            name: settings-student-staging
        - secretRef:
            name: secrets-student-staging
        image: <redacted>
        imagePullPolicy: Always
        name: init1
        resources: {}
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - mountPath: /var/www/html
          name: code
        - mountPath: /var/www/html/web/sites/default/files
          name: files
      - command:
        - /bin/sh
        - -c
        - |
          echo "Init:  download webform libraries, import config (drush cim), cache rebuild (drush cr)";
          export http_proxy="<redacted>";
          export https_proxy="<redacted>";
          printenv | grep -i proxy
          vendor/bin/drush webform:libraries:download;
          vendor/bin/drush updb;
          vendor/bin/drush cim;
          vendor/bin/drush cr;
          #sleep 100;
        envFrom:
        - configMapRef:
            name: settings-student-staging
        - secretRef:
            name: secrets-student-staging
        image: <redacted>
        imagePullPolicy: Always
        name: init2
        resources:
          limits:
            cpu: "2"
            memory: 2Gi
          requests:
            cpu: 700m
            memory: 384Mi
        securityContext:
          allowPrivilegeEscalation: false
          runAsUser: 0
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - mountPath: /var/www/html
          name: code
        - mountPath: /socket
          name: socket
        - mountPath: /var/www/html/web/sites/default/files
          name: files
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      terminationGracePeriodSeconds: 30
      volumes:
      - emptyDir: {}
        name: code
      - emptyDir: {}
        name: socket
      - configMap:
          defaultMode: 420
          name: nginx-config-student-staging
        name: nginx-config-volume
      - name: files
        persistentVolumeClaim:
          claimName: pvclaim-student-staging
status:
  availableReplicas: 1
  conditions:
  - lastTransitionTime: "2024-10-18T12:35:25Z"
    lastUpdateTime: "2024-10-18T12:36:53Z"
    message: ReplicaSet "student-staging-db45fffcd" has successfully progressed.
    reason: NewReplicaSetAvailable
    status: "True"
    type: Progressing
  - lastTransitionTime: "2024-11-04T15:11:47Z"
    lastUpdateTime: "2024-11-04T15:11:47Z"
    message: Deployment has minimum availability.
    reason: MinimumReplicasAvailable
    status: "True"
    type: Available
  observedGeneration: 14
  readyReplicas: 1
  replicas: 1
  updatedReplicas: 1
adrianmoisey commented 2 weeks ago

Those seem fine, what do the Pods look like for that Deployment? Is the VPA evicting them in order to apply a recommendation?

voelzmo commented 2 weeks ago

The error from your original post indicate that there are Pods in your cluste (e.g. kube-system/kube-proxy-srv-rke-246) which have an ownerRef pointing to a Node object. Those Pods cannot be scaled with VPA, as it cannot be ensured that they would be restarted correctly. So only for the Pods where you see this error message, VPA isn't working. For the other examples, Adrian already looked at, VPA seems to work fine.

voelzmo commented 2 weeks ago

/remove-kind bug /kind support

voelzmo commented 2 weeks ago

/close

closing this for now, please re-open with additional information if you feel VPA isn't working correctly.

k8s-ci-robot commented 2 weeks ago

@voelzmo: Closing this issue.

In response to [this](https://github.com/kubernetes/autoscaler/issues/7473#issuecomment-2467670348): >/close > >closing this for now, please re-open with additional information if you feel VPA isn't working correctly. Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes-sigs/prow](https://github.com/kubernetes-sigs/prow/issues/new?title=Prow%20issue:) repository.
Rafael-Schippers commented 2 weeks ago

@voelzmo The error in my original post was cut short since I didn't want to clutter to much but it was for all 3 nodes.

Also I don't think anyone looked at the details of my last info dump. Adrian posted 2min after the follow-up post I made so I think he commented on my orginal post.

adrianmoisey commented 2 weeks ago

There seem to be two issues mixed up into one:

  1. fail to get pod controller error messages
  2. verticalpodautoscaler resources get created but not applied to the pods

For number 1 is not an issue, it's a message saying that that particular pod doesn't have an owner. This seems to be unrelated to the pods that do have a VPA.

For number 2, so far I don't see an issue. I was waiting for more info here: https://github.com/kubernetes/autoscaler/issues/7473#issuecomment-2464762556

Rafael-Schippers commented 2 weeks ago

Hi @adrianmoisey thanks for the quick reply, for number 2 I posted the student-staging vpa and deployment here https://github.com/kubernetes/autoscaler/issues/7473#issuecomment-2464756938 and the vpa doesn't get applied to it or am I seeing it wrong?

adrianmoisey commented 2 weeks ago

Hi @adrianmoisey thanks for the quick reply, for number 2 I posted the student-staging vpa and deployment here #7473 (comment) and the vpa doesn't get applied to it or am I seeing it wrong?

Right below that I asked to see the Pod.

VPA doesn't modify Deployments, it modifies Pods as they are created. So you can't tell from the Deployment if the Pod is getting the right resources.

Rafael-Schippers commented 2 weeks ago

kubectl get pod student-staging-db45fffcd-jf9jj -o yaml

apiVersion: v1
kind: Pod
metadata:
  creationTimestamp: "2024-11-04T15:10:23Z"
  generateName: student-staging-db45fffcd-
  labels:
    app: student-staging
    pod-template-hash: db45fffcd
  name: student-staging-db45fffcd-jf9jj
  namespace: dev-intranet-student
  ownerReferences:
  - apiVersion: apps/v1
    blockOwnerDeletion: true
    controller: true
    kind: ReplicaSet
    name: student-staging-db45fffcd
    uid: a4411b90-73e9-4b0a-9f51-9054dd7ce11b
  resourceVersion: "157192335"
  uid: 8f402dae-2573-41eb-91dd-77293762f819
spec:
  containers:
  - image: nginxinc/nginx-unprivileged:alpine
    imagePullPolicy: IfNotPresent
    name: nginx
    ports:
    - containerPort: 8080
      protocol: TCP
    resources:
      limits:
        cpu: 500m
        memory: 384Mi
      requests:
        cpu: 250m
        memory: 256Mi
    terminationMessagePath: /dev/termination-log
    terminationMessagePolicy: File
    volumeMounts:
    - mountPath: /var/www/html
      name: code
    - mountPath: /var/www/html/web/sites/default/files
      name: files
    - mountPath: /etc/nginx/conf.d/default.conf
      name: nginx-config-volume
      subPath: nginx.conf
    - mountPath: /socket
      name: socket
    - mountPath: /var/run/secrets/kubernetes.io/serviceaccount
      name: kube-api-access-hd4vp
      readOnly: true
  - envFrom:
    - configMapRef:
        name: settings-student-staging
    - secretRef:
        name: secrets-student-staging
    image: <redacted>
    imagePullPolicy: Always
    name: php
    resources:
      limits:
        memory: 4Gi
      requests:
        cpu: "1"
        memory: 2Gi
    terminationMessagePath: /dev/termination-log
    terminationMessagePolicy: File
    volumeMounts:
    - mountPath: /var/www/html
      name: code
    - mountPath: /socket
      name: socket
    - mountPath: /var/www/html/web/sites/default/files
      name: files
    - mountPath: /var/run/secrets/kubernetes.io/serviceaccount
      name: kube-api-access-hd4vp
      readOnly: true
  dnsPolicy: ClusterFirst
  enableServiceLinks: true
  imagePullSecrets:
  - name: ap-gitlab-registry
  initContainers:
  - envFrom:
    - configMapRef:
        name: settings-student-staging
    - secretRef:
        name: secrets-student-staging
    image: <redacted>
    imagePullPolicy: Always
    name: init1
    resources: {}
    terminationMessagePath: /dev/termination-log
    terminationMessagePolicy: File
    volumeMounts:
    - mountPath: /var/www/html
      name: code
    - mountPath: /var/www/html/web/sites/default/files
      name: files
    - mountPath: /var/run/secrets/kubernetes.io/serviceaccount
      name: kube-api-access-hd4vp
      readOnly: true
  - command:
    - /bin/sh
    - -c
    - |
      echo "Init:  download webform libraries, import config (drush cim), cache rebuild (drush cr)";
      export http_proxy="<redacted>";
      export https_proxy="<redacted>";
      printenv | grep -i proxy
      vendor/bin/drush webform:libraries:download;
      vendor/bin/drush updb;
      vendor/bin/drush cim;
      vendor/bin/drush cr;
      #sleep 100;
    envFrom:
    - configMapRef:
        name: settings-student-staging
    - secretRef:
        name: secrets-student-staging
    image: <redacted>
    imagePullPolicy: Always
    name: init2
    resources:
      limits:
        cpu: "2"
        memory: 2Gi
      requests:
        cpu: 700m
        memory: 384Mi
    securityContext:
      allowPrivilegeEscalation: false
      runAsUser: 0
    terminationMessagePath: /dev/termination-log
    terminationMessagePolicy: File
    volumeMounts:
    - mountPath: /var/www/html
      name: code
    - mountPath: /socket
      name: socket
    - mountPath: /var/www/html/web/sites/default/files
      name: files
    - mountPath: /var/run/secrets/kubernetes.io/serviceaccount
      name: kube-api-access-hd4vp
      readOnly: true
  nodeName: srv-rke-246
  preemptionPolicy: PreemptLowerPriority
  priority: 0
  restartPolicy: Always
  schedulerName: default-scheduler
  securityContext: {}
  serviceAccount: default
  serviceAccountName: default
  terminationGracePeriodSeconds: 30
  tolerations:
  - effect: NoExecute
    key: node.kubernetes.io/not-ready
    operator: Exists
    tolerationSeconds: 300
  - effect: NoExecute
    key: node.kubernetes.io/unreachable
    operator: Exists
    tolerationSeconds: 300
  volumes:
  - emptyDir: {}
    name: code
  - emptyDir: {}
    name: socket
  - configMap:
      defaultMode: 420
      name: nginx-config-student-staging
    name: nginx-config-volume
  - name: files
    persistentVolumeClaim:
      claimName: pvclaim-student-staging
  - name: kube-api-access-hd4vp
    projected:
      defaultMode: 420
      sources:
      - serviceAccountToken:
          expirationSeconds: 3607
          path: token
      - configMap:
          items:
          - key: ca.crt
            path: ca.crt
          name: kube-root-ca.crt
      - downwardAPI:
          items:
          - fieldRef:
              apiVersion: v1
              fieldPath: metadata.namespace
            path: namespace
status:
  conditions:
  - lastProbeTime: null
    lastTransitionTime: "2024-11-04T15:10:30Z"
    status: "True"
    type: PodReadyToStartContainers
  - lastProbeTime: null
    lastTransitionTime: "2024-11-04T15:11:46Z"
    status: "True"
    type: Initialized
  - lastProbeTime: null
    lastTransitionTime: "2024-11-04T15:11:47Z"
    status: "True"
    type: Ready
  - lastProbeTime: null
    lastTransitionTime: "2024-11-04T15:11:47Z"
    status: "True"
    type: ContainersReady
  - lastProbeTime: null
    lastTransitionTime: "2024-11-04T15:10:23Z"
    status: "True"
    type: PodScheduled
  containerStatuses:
  - containerID: containerd://826dd1f990ee0ac0ef430fadb7e4cd0e6a58b2b11f6361fddabc1ac8ae03be33
    image: docker.io/nginxinc/nginx-unprivileged:alpine
    imageID: docker.io/nginxinc/nginx-unprivileged@sha256:16f6d3e75e8e00832788c9e3d52fd00b29d363df1858d1906348752b539cd944
    lastState: {}
    name: nginx
    ready: true
    restartCount: 0
    started: true
    state:
      running:
        startedAt: "2024-11-04T15:11:46Z"
  - containerID: containerd://c1d5291b424c2f63e608bde2d28db7a7fcd4960a214728dd0326c88554495111
    image: <redacted>
    imageID: <redacted>
    lastState: {}
    name: php
    ready: true
    restartCount: 0
    started: true
    state:
      running:
        startedAt: "2024-11-04T15:11:47Z"
  hostIP: 10.200.223.246
  hostIPs:
  - ip: 10.200.223.246
  initContainerStatuses:
  - containerID: containerd://2f56870bf829bbbf9b2981bc9e1b7fa75422c5dc6a747e019f57f07187d038aa
    image: registry.git.ap.be/k8s/viavictor/intranet/ap-student-d10:400fca28
    imageID: registry.git.ap.be/k8s/viavictor/intranet/ap-student-d10@sha256:728fe0b49a5ee9154c175a9ef681c9106324ab75c861d396493f0449088a2c0f
    lastState: {}
    name: init1
    ready: true
    restartCount: 0
    started: false
    state:
      terminated:
        containerID: containerd://2f56870bf829bbbf9b2981bc9e1b7fa75422c5dc6a747e019f57f07187d038aa
        exitCode: 0
        finishedAt: "2024-11-04T15:11:09Z"
        reason: Completed
        startedAt: "2024-11-04T15:10:30Z"
  - containerID: containerd://0c83e58cf5353a455c528710b84642217434bf631bd7f161ab8b704126eb9f4f
    image: <redacted>
    imageID: <redacted>
    lastState: {}
    name: init2
    ready: true
    restartCount: 0
    started: false
    state:
      terminated:
        containerID: containerd://0c83e58cf5353a455c528710b84642217434bf631bd7f161ab8b704126eb9f4f
        exitCode: 0
        finishedAt: "2024-11-04T15:11:45Z"
        reason: Completed
        startedAt: "2024-11-04T15:11:14Z"
  phase: Running
  podIP: 10.42.0.62
  podIPs:
  - ip: 10.42.0.62
  qosClass: Burstable
  startTime: "2024-11-04T15:10:23Z"
adrianmoisey commented 2 weeks ago

Oh, I see a potential problem, the Deployment only has a single replica. By default the VPA won't evict it. See https://github.com/kubernetes/autoscaler/blob/93f74c0948ae9eec100fcffee300dbc44b0f7f83/vertical-pod-autoscaler/FAQ.md#i-get-recommendations-for-my-single-pod-replicaset-but-they-are-not-applied

Rafael-Schippers commented 2 weeks ago

Oh okay that explains quite a lot. Thanks for helping me out here!

adrianmoisey commented 2 weeks ago

No problem