Request timeout not properly set
This product is not supported for your selected
Datadog site. (
).
Id: d89a15bb-8dba-4c71-9529-bef6729b9c09
Cloud Provider: k8s
Platform: Kubernetes
Severity: Medium
Category: Availability
Learn More
Description
When kube-apiserver
is used, the --request-timeout
flag must not be set to more than 300 seconds. Values parsed as greater than 300 seconds are reported as incorrect.
The rule inspects containers
and initContainers
, checking both command
and args
, and converts duration values with h
, m
, and s
suffixes (for example 1h30m
, 45m
, 30s
) into seconds for comparison.
Compliant Code Examples
apiVersion: v1
kind: Pod
metadata:
name: command-demo
labels:
purpose: demonstrate-command
spec:
containers:
- name: command-demo-container
image: gcr.io/google_containers/kube-apiserver-amd64:v1.6.0
command: ["kube-apiserver"]
args: ["--request-timeout=300s"]
restartPolicy: OnFailure
apiVersion: v1
kind: Pod
metadata:
name: command-demo
labels:
purpose: demonstrate-command
spec:
containers:
- name: command-demo-container
image: gcr.io/google_containers/kube-apiserver-amd64:v1.6.0
command: ["kube-apiserver"]
args: []
restartPolicy: OnFailure
Non-Compliant Code Examples
apiVersion: v1
kind: Pod
metadata:
name: command-demo
labels:
purpose: demonstrate-command
spec:
containers:
- name: command-demo-container
image: gcr.io/google_containers/kube-apiserver-amd64:v1.6.0
command: ["kube-apiserver"]
args: ["--request-timeout=1h0s"]
restartPolicy: OnFailure
apiVersion: v1
kind: Pod
metadata:
name: command-demo
labels:
purpose: demonstrate-command
spec:
containers:
- name: command-demo-container
image: gcr.io/google_containers/kube-apiserver-amd64:v1.6.0
command: ["kube-apiserver"]
args: ["--request-timeout=6m10s"]
restartPolicy: OnFailure
apiVersion: v1
kind: Pod
metadata:
name: command-demo
labels:
purpose: demonstrate-command
spec:
containers:
- name: command-demo-container
image: gcr.io/google_containers/kube-apiserver-amd64:v1.6.0
command: ["kube-apiserver"]
args: ["--request-timeout=400s"]
restartPolicy: OnFailure