Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
K

kube-score

> DevOps
Open source

Kubernetes object analysis with recommendations for improved reliability and security. kube-score actively prevents downtime and bugs in your Kubernetes YAML an

3.1K stars0 likes3 views
WebsiteGitHub

About

Kubernetes object analysis with recommendations for improved reliability and security. kube-score actively prevents downtime and bugs in your Kubernetes YAML an

kube-score


kube-score is a tool that performs static code analysis of your Kubernetes object definitions.

The output is a list of recommendations of what you can improve to make your application more secure and resilient.

You can test kube-score out in the browser with the online demo (source).

Installation

kube-score is easy to install, and is available from the following sources:

Distribution Command / Link
Pre-built binaries for macOS, Linux, and Windows GitHub releases
Docker docker pull zegl/kube-score (Docker Hub)
Homebrew (macOS and Linux) brew install kube-score
Krew (macOS and Linux) kubectl krew install score

Sponsors

Your company here?

Checks

For a full list of checks, see README_CHECKS.md.

  • Container limits (should be set)
  • Pod is targeted by a NetworkPolicy, both egress and ingress rules are recommended
  • Deployments and StatefulSets should have a PodDisruptionPolicy
  • Deployments and StatefulSets should have host PodAntiAffinity configured
  • Container probes, a readiness should be configured, and should not be identical to the liveness probe. Read more in README_PROBES.md.
  • Container securityContext, run as high number user/group, do not run as root or with privileged root fs. Read more in README_SECURITYCONTEXT.md.
  • Stable APIs, use a stable API if available (supported: Deployments, StatefulSets, DaemonSet)

Example output

Usage in CI

kube-score can run in your CI/CD environment and will exit with exit code 1 if a critical error has been found. The trigger level can be changed to warning with the --exit-one-on-warning argument.

The input to kube-score should be all applications that you deploy to the same namespace for the best result.

Example with Helm

bash
helm template my-app | kube-score score -

Example with Kustomize

bash
kustomize build . | kube-score score -

Example with static YAMLs

bash
kube-score score my-app/*.yaml
bash
kube-score score my-app/deployment.yaml my-app/service.yaml

Example with an existing cluster

bash
kubectl api-resources --verbs=list --namespaced -o name \
  | xargs -n1 -I{} bash -c "kubectl get {} --all-namespaces -oyaml && echo ---" \
  | kube-score score -

Example with Docker

bash
docker run -v $(pwd):/project zegl/kube-score:latest score my-app/*.yaml

Configuration

…

Ignoring a test

Tests can be ignored in the whole run of the program, with the --ignore-test flag.

A test can also be ignored on a per-object basis, by adding the annotation kube-score/ignore to the object. The value should be a comma-separated string of the test IDs.

Example:

Testing this object will temporarily disable the service-type test, which warns against using services of type NodePort.

yaml
apiVersion: v1
kind: Service
metadata:
  name: node-port-service-with-ignore
  namespace: foospace
  annotations:
    kube-score/ignore: service-type
spec:
  selector:
    app: my-app
  ports:
  - protocol: TCP
    port: 80
    targetPort: 8080
  type: NodePort

Enabling an optional test

Optional tests can be enabled in the whole run of the program, with the --enable-optional-test flag.

A test can also be enabled on a per-object basis, by adding the annotation kube-score/enable to the object. The value should be a comma-separated string of the test IDs.

Example:

Testing this object will enable the container-seccomp-profile test. Also, multiple tests defined by kube-score/ignore are also ignored at the same.

…

Building from source

kube-score requires Go 1.21 or later to build. Clone this repository, and then:

bash
# Build the project
go build ./cmd/kube-score

# Run all tests
go test -v ./...

Contributing?

Do you want to help out? Take a look at the Contributing Guidelines for more info.

Dependencies

Project Version
go.dev ^1.21

Made by

Issues· 53 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Goanalysisautomationchartsci

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
CategoryDevOps
PricingOpen source

> Related tools

D
Docker
容器化平台,标准化应用交付
G
GitHub Actions
GitHub 原生 CI/CD 工作流
N
Nginx
高性能 Web 服务器与反向代理