Prerequisites
- Kubernetes 1.27 or newer with in-place Pod resource resize enabled.
- cert-manager for the default webhook TLS configuration, or your own TLS secret.
- A target Deployment, StatefulSet, or Argo Rollout.
Kapr changes live pod resources through the
pods/resize subresource. Confirm the feature is available on your cluster before production use.Install with Helm
helm install kapr oci://ghcr.io/kapr-io/charts/kapr \
--namespace kapr-system \
--create-namespaceTo install from a checkout instead:
helm install kapr ./charts/kapr \
--namespace kapr-system \
--create-namespaceWhen cert-manager is unavailable, set webhook.certManager.enabled=false and provide webhook.tls.existingSecret.
Create a Manual canary
apiVersion: kapr.io/v1alpha1
kind: ResourceCanary
metadata:
name: checkout-rightsize
namespace: production
spec:
targetRef:
apiVersion: apps/v1
kind: Deployment
name: checkout
recommendation:
source: Manual
manual:
containers:
- name: app
resources:
requests: { cpu: 500m, memory: 768Mi }
limits: { cpu: "1", memory: 1Gi }
rollout:
maxConcurrentResizes: 2
podSelection: { strategy: StableHash }
steps:
- { percent: 10, pause: 10m }
- { percent: 50, pause: 20m }
- { percent: 100, pause: 30m }
safety:
minReadyPods: 2
stopIfTargetWorkloadUpdating: true
persistence:
mode: AdmissionOnNextPodTemplateChangekubectl apply -f resourcecanary.yaml
Observe progress
kubectl get resourcecanary checkout-rightsize -n production -w
kubectl describe resourcecanary checkout-rightsize -n production
kubectl get resourcecanary checkout-rightsize -n production -o yamlInspect status.validation.pods for per-pod resize state and status.conditions for blocked, degraded, or failed decisions.
Build from source
make test
make build
./bin/manager --metrics-bind-address=:8080 --leader-elect=false