Kubernetes best practices
Recipe ID
org.openrewrite.kubernetes.KubernetesBestPracticesArtifact
org.openrewrite.recipe:rewrite-kubernetesApplies best practices to Kubernetes manifests.
Usage
This recipe has no required configuration options. You’ll need the Moderne CLI configured before running the command below.
mod run . --recipe org.openrewrite.kubernetes.KubernetesBestPracticesIf the recipe isn’t available locally, install it with:
mod config recipes jar install org.openrewrite.recipe:rewrite-kubernetes:3.17.4Definition
This recipe runs the following recipes in order.
- Ensure liveness probe is configured
org.openrewrite.kubernetes.MissingPodLivenessProbe - Ensure readiness probe is configured
org.openrewrite.kubernetes.MissingPodReadinessProbe - Ensure CPU request is set
org.openrewrite.kubernetes.MissingCpuRequest - Ensure CPU limits are set
org.openrewrite.kubernetes.MissingCpuLimits - Ensure memory request is set
org.openrewrite.kubernetes.MissingMemoryRequest - Ensure memory limits are set
org.openrewrite.kubernetes.MissingMemoryLimits - No privileged containers
org.openrewrite.kubernetes.NoPrivilegedContainers - Ensure lifecycle rule on
StorageBucketorg.openrewrite.kubernetes.LifecycleRuleOnStorageBucket - No host process ID sharing
org.openrewrite.kubernetes.NoHostProcessIdSharing - No host IPC sharing
org.openrewrite.kubernetes.NoHostIPCSharing - No root containers
org.openrewrite.kubernetes.NoRootContainers - Ensure image pull policy is
Alwaysorg.openrewrite.kubernetes.ImagePullPolicyAlways - No privilege escalation
org.openrewrite.kubernetes.NoPrivilegeEscalation - No host network sharing
org.openrewrite.kubernetes.NoHostNetworkSharing - Read-only root filesystem
org.openrewrite.kubernetes.ReadOnlyRootFilesystem - Limit root capabilities in a container
org.openrewrite.kubernetes.LimitContainerCapabilities
Data tables
Structured output this recipe can produce.
- Source files that had resultsSource files that were modified by the recipe run.
org.openrewrite.table.SourcesFileResults - Source files that had search resultsSearch results that were found during the recipe run.
org.openrewrite.table.SearchResults - Source files that errored on a recipeThe details of all errors produced by a recipe run.
org.openrewrite.table.SourcesFileErrors - Recipe performanceStatistics used in analyzing the performance of recipes.
org.openrewrite.table.RecipeRunStats