You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sustainable Kubernetes deployment: Replicas number limitation
Platform
OS
OS version
Langage
-
-
Kubernetes (yaml)
Main caracteristics
ID
Title
Category
Sub-category
CRKUB003
limit replicas number
Deployment
Sustainable deploy
Severity / Remediation Cost
Severity
Remediation Cost
Minor
Minor
Rule short description
In a Kubernetes deployment file, define a high replicas number is useless and consume unnecessary resources at startup.
Rule complete description
Text
In Kubernetes configuration, the desired replicas number at start can be defined in a yaml file.
Use a high number of replicas at start might not be a good idea because it will consumes unnecessary resources.
It is better to configure an horizontal pod autoscaling.
the value is define like this:
spec.replicas
HTML
<p>Defining the yaml file
<code>---
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
labels:
app: nginx
spec:
replicas: 3
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.7.9
ports:
- containerPort: 80</code> as example to perform a deployment.</p><p>Limit replicas number <code>replicas: x</code> to less than 3 and use horizontal pod autoscaling</p><h2>Noncompliant Code Example</h2><pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
labels:
app: nginx
spec:
replicas: 8</code></pre><h2>Compliant Solution</h2><pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
labels:
app: nginx
spec:
replicas: 2</code></pre>
Implementation principle
Inspect yaml file and find 'kind: Deployment'
Inspect the found file and find 'replicas: x'
Compare the replicas number to the limit
If the found value is above the limit, report the line
The text was updated successfully, but these errors were encountered:
JulienBertrand
changed the title
[WEB][DRAFT][42108] Kubernetes deployment: Replicas number limitation
[WEB][42108] Kubernetes deployment: Replicas number limitation
Apr 6, 2023
\newpage
Sustainable Kubernetes deployment: Replicas number limitation
Platform
Main caracteristics
Severity / Remediation Cost
Rule short description
In a Kubernetes deployment file, define a high replicas number is useless and consume unnecessary resources at startup.
Rule complete description
Text
In Kubernetes configuration, the desired replicas number at start can be defined in a yaml file.
Use a high number of replicas at start might not be a good idea because it will consumes unnecessary resources.
It is better to configure an horizontal pod autoscaling.
the value is define like this:
HTML
Implementation principle
The text was updated successfully, but these errors were encountered: