# Source: https://docs.datadoghq.com/security/code_security/iac_security/iac_rules/k8s/rotate_kubelet_server_certificate_not_active.md

---
title: Rotate Kubelet server certificate not active
description: Datadog, the leading service for cloud-scale monitoring.
breadcrumbs: >-
  Docs > Datadog Security > Code Security > Infrastructure as Code (IaC)
  Security > IaC Security Rules > Rotate Kubelet server certificate not active
---

# Rotate Kubelet server certificate not active

{% callout %}
# Important note for users on the following Datadog sites: app.ddog-gov.com

{% alert level="danger" %}
This product is not supported for your selected [Datadog site](https://docs.datadoghq.com/getting_started/site). ().
{% /alert %}

{% /callout %}

## Metadata{% #metadata %}

**Id:** `1c621b8e-2c6a-44f5-bd6a-fb0fb7ba33e2`

**Cloud Provider:** Kubernetes

**Platform:** Kubernetes

**Severity:** Medium

**Category:** Secret Management

#### Learn More{% #learn-more %}

- [Provider Reference](https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/)

### Description{% #description %}

The `RotateKubeletServerCertificate` feature gate must be set to `true`. It must be enabled either by including `RotateKubeletServerCertificate=true` in the `--feature-gates=` flag for kube components (for example `kubelet` or `kube-controller-manager`) or by setting `featureGates.RotateKubeletServerCertificate` to `true` in `KubeletConfiguration`. This rule reports an `IncorrectValue` when the feature gate is `false`.

## Compliant Code Examples{% #compliant-code-examples %}

```yaml
apiVersion: kubelet.config.k8s.io/v1beta1
kind: KubeletConfiguration
address: "192.168.0.8"
port: 20250
serializeImagePulls: false
evictionHard:
    memory.available:  "200Mi"
featureGates:
    RotateKubeletServerCertificate: true
```

```json
{
    "kind": "KubeletConfiguration",
    "address": "192.168.0.8",
    "apiVersion": "kubelet.config.k8s.io/v1beta1",
    "evictionHard": {
        "memory.available": "200Mi"
    },
    "port": 20250,
    "serializeImagePulls": false
}
```

```json
{
    "kind": "KubeletConfiguration",
    "address": "192.168.0.8",
    "apiVersion": "kubelet.config.k8s.io/v1beta1",
    "evictionHard": {
        "memory.available": "200Mi"
    },
    "featureGates": {
        "RotateKubeletServerCertificate": true
    },
    "port": 20250,
    "serializeImagePulls": false
}
```

## Non-Compliant Code Examples{% #non-compliant-code-examples %}

```yaml
apiVersion: v1
kind: Pod
metadata:
  name: command-demo
  labels:
    purpose: demonstrate-command
spec:
  containers:
    - name: command-demo-container
      image: foo/bar
      command: ["kubelet"]
      args: ["--feature-gates=RotateKubeletServerCertificate=false"]
  restartPolicy: OnFailure
```

```json
{
    "kind": "KubeletConfiguration",
    "address": "192.168.0.8",
    "apiVersion": "kubelet.config.k8s.io/v1beta1",
    "evictionHard": {
        "memory.available": "200Mi"
    },
    "featureGates": {
        "RotateKubeletServerCertificate": false
    },
    "port": 20250,
    "serializeImagePulls": false
}
```

```yaml
apiVersion: v1
kind: Pod
metadata:
  name: command-demo
  labels:
    purpose: demonstrate-command
spec:
  containers:
    - name: command-demo-container7
      image: gcr.io/google_containers/kube-apiserver-amd64:v1.6.0
      command: ["kube-controller-manager"]
      args: ["--feature-gates=RotateKubeletServerCertificate=false"]
  restartPolicy: OnFailure
```