<p>I manage a spring applications on K8s.</p>
<p>Pods take about 2~3 minutes for the application to run, and the probe waiting time is set at 4 minutes.
<a href="https://i.stack.imgur.com/wyZlC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wyZlC.png" alt="enter image description here" /></a></p>
<p><a href="https://i.stack.imgur.com/PVCTD.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PVCTD.png" alt="enter image description here" /></a></p>
<p>After re-deploy an application, the CPU Spike symptom occurs while the Pod is being initialized. So, when Rolling Update is performed, all Pods are scaled up due to the CPU spike symptom.
<a href="https://i.stack.imgur.com/K8AWp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/K8AWp.png" alt="enter image description here" /></a></p>
<p><a href="https://i.stack.imgur.com/bjPmh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bjPmh.png" alt="enter image description here" /></a></p>
<p>I don't wanna collect a cpu while initialize application. Is there any way to delay collect cpu info?</p>
<p><strong>K8s Version</strong> : 1.26.3</p>
<p><strong>Deployment Info</strong></p>
<pre><code>...
livenessProbe:
          failureThreshold: 3
          httpGet:
            path: /probex
            port: 9006
            scheme: HTTP
          initialDelaySeconds: 240
          periodSeconds: 60
          successThreshold: 1
          timeoutSeconds: 1
        name: sample-container
        ports:
        - containerPort: 9006
          name: http
          protocol: TCP
        readinessProbe:
          failureThreshold: 3
          httpGet:
            path: /probex
            port: 9006
            scheme: HTTP
          initialDelaySeconds: 240
          periodSeconds: 60
          successThreshold: 1
          timeoutSeconds: 1
        resources:
          limits:
            memory: 8Gi
          requests:
            cpu: 500m
            memory: 8Gi
...
</code></pre>
<p><strong>Hpa Info</strong></p>
<pre><code>...
spec:
  maxReplicas: 5
  metrics:
  - resource:
      name: memory
      target:
        averageUtilization: 70
        type: Utilization
    type: Resource
  - resource:
      name: cpu
      target:
        averageUtilization: 70
        type: Utilization
    type: Resource
  minReplicas: 1
...
</code></pre>

Daniel Lee
<p>You can read about <code>stabilizationWindowSeconds</code> and <code>periodSeconds</code> paramters in the hpa configuration and tune them as per your use case.</p>
