kran docs

Prerequisites

Kran drives four external programs.

Tool Why kran needs it Install
docker with buildx builds and pushes the image docs.docker.com/get-docker
krane renders the templates and deploys them gem install krane
kubectl logs, exec, details, audit kubernetes.io
ejson only when a registry password is read from secrets.ejson gem install ejson

One command checks all of them at once:

# a tool not on PATH shows `not found`; one that fails to run shows its first error line
$ kran version
kran     1.0.0
docker   Docker version 27.5.1, build 9f9e405
krane    failed: Could not locate Gemfile (Bundler::GemfileNotFound)
kubectl  not found

kran version works without a configuration file. With one, the krane line uses krane.command.

docker

--platform and pushing straight from a build both come from BuildKit, through the buildx plugin. Docker Desktop and recent Docker Engine packages ship it.

$ docker buildx version
github.com/docker/buildx v0.20.1 47ac5aa

Without buildx, --platform fails for any platform other than the host’s own. kran build details prints the daemon and builders a build would use.

krane

Krane applies the manifests, waits for the rollout and reports failures. Kran replaces no part of it. Install it globally, or pin it in a deploy bundle and tell kran how to run it:

krane:
  command: BUNDLE_GEMFILE=deploy/Gemfile bundle exec krane

Kran checks the first word of that command that is not an environment assignment — here bundle, not krane. See krane templates for what krane renders.

ejson

ejson encrypts values inside a JSON file so the file can be committed. You need the binary locally only when a registry password is read from it.

The cluster needs its own copy of the private key, in a Secret named ejson-keys. That is a separate thing from the key on your machine. See Secrets.

A kubeconfig and a context

$ kubectl config get-contexts
CURRENT   NAME        CLUSTER     AUTHINFO         NAMESPACE
*         prod-east   prod-east   deploy@acme
          stage-eu    stage-eu    deploy@acme

The NAME column goes into kubernetes.context. Add kubernetes.kubeconfig when the cluster has a file of its own; kran then prefixes every krane and kubectl command with it and leaves your shell’s own selection alone.

kubernetes:
  kubeconfig: ~/.kube/prod-east.yml
  context: prod-east
  namespace: storefront