Kubernetes - Testing
Unit Tests
Use a fake client: sigs.k8s.io/controller-runtime/pkg/client/fake
Integration Tests
Some of the tools to facilitate integration tests (ordered by complexity of the test cases.)
| Tool | Note |
|---|---|
| kuttl | only for CRUD |
| envtest | only k8s API server + etcd |
| kind | complete k8s cluster |
More details:
- kuttl: test k8s operators using only YAML (no Go code), good for CRUD testing.
- envtest:
- Running locally, only k8s API server + etcd; NO kubelet, controller-manager or other components.
- Good for testing controllers.
- Part of
controller-runtime(sigs.k8s.io/controller-runtime/pkg/envtest)
- kind:
- https://kind.sigs.k8s.io/
- creates k8s clusters in docker.
E2E Tests
In a real or simulated environment.
E.g. functional, load & performance, disaster recovery, upgrade.
Recommended ReadingSponsored
Kubernetes
Kubernetes - Overview
Kubernetes - Static Pods
Kubernetes - APIs
Kubernetes - Distributions
Kubernetes - Auth
Kubernetes - Operators
Kubernetes - Registries
Kubernetes - Container Runtimes (CRI)
Kubernetes - Storage (CSI)
Kubernetes - Networking (CNI)
Kubernetes - Bootstrapping
Kubernetes - Testing
Kubernetes - Source Code
Kubernetes - kubeconfig
Kubernetes - Webhooks
Kubernetes - OS
Kubernetes - DNS
Kubernetes - Versus
Kubernetes - Upgrade
Kubernetes - Troubleshooting
Kubernetes - Logging
Kubernetes - AddOns
Kubernetes - Pod Sandbox
Kubernetes - cgroup
Kubernetes - Objects
Kubernetes - Components
Extending Kubernetes
Cloud Native Ecosystem
Kubernetes Troubleshooting

