guid.foo lanyard
Hands credentials to Kubernetes pods that prove who they are with their ServiceAccount tokens.
docker pull seamark.cr/guid.foo/lanyard:latest
lanyard
lanyard issues short-lived credentials to pods in a
Kubernetes cluster. A pod proves who it is
with its ServiceAccount token, and lanyard returns each credential
that the ServiceAccount is allowed to have.
Today it issues tokens for GitHub,
Gitea, and atproto,
and returns the contents of a Secret. atproto is the protocol behind
Bluesky and the git forge
Tangled.
In a pod with the lanyard binary:
git push # git gets a token for this repository from lanyard
lanyard run /usr/bin/gh pr list # gh runs with a token for its repository
lanyard github-token example-org/widgets # print a GitHub token for one repository
lanyard secret greeting message # print one key of a Secret
Use lanyard when AI agents or other unattended jobs run in your cluster.
Their pods start with no credential except their own identity. The keys
and passwords that lanyard uses to make tokens stay in lanyard’s own
namespace, and no workload’s pod has them.
You declare each account once for the cluster, as a GitHubApp, a
GiteaAccount, or an AtprotoAccount. A Badge in a workload’s
namespace then lists the tokens and Secret objects that the pods of
its ServiceAccounts may have. lanyard works as
git’s credential helper. lanyard run starts
gh, tea,
or tg with the credential that each command needs.
lanyard works without any other project.
simmer, which runs Claude
Code sessions in pods, uses
lanyard like any other workload. simmer’s pods get their forge
credentials from lanyard. simmer also asks lanyard for the atproto
service tokens that some MCP servers
require.
Install
lanyard needs:
- Kubernetes 1.30 or newer with at least two nodes, and
kubectl. For
one node, follow theinstallskill. - A login for atcr.io, which hosts lanyard’s
image and does not allow anonymous pulls. - For each kind of token you want: a GitHub App, a Gitea user’s
password, or an atproto app password. The first use below needs none
of them.
Write a kustomization that uses lanyard’s base
from this repository and sets the image’s tag, then apply it:
# lanyard/kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- https://tangled.org/guid.foo/lanyard//deploy?ref=main
images:
- name: atcr.io/guid.foo/lanyard
newTag: latest
kubectl apply -k lanyard/
kubectl -n lanyard-system rollout status deploy/lanyard
latest is the newest build. To pin a release, use a build’s own tag,
which is its UTC time and commit, such as 20261130091538-dd128cd. The
install skill pins a release, adds
monitoring, and follows releases with Flux.
The base creates the namespace lanyard-system, the kinds GitHubApp,
GiteaAccount, AtprotoAccount, and Badge, and the service at
http://lanyard.lanyard-system.svc:8080.
First use
This example gives one pod one Secret. Create a namespace, a
ServiceAccount, and a Secret. Then apply a Badge that lets the
ServiceAccount’s pods read the Secret, and a pod that asks for it:
kubectl create namespace example
kubectl -n example create serviceaccount reader
kubectl -n example create secret generic greeting --from-literal=message=hello
kubectl apply -f first.yaml
# first.yaml
apiVersion: lanyard.guid.foo/v1alpha1
kind: Badge
metadata: { name: first, namespace: example }
spec:
serviceAccounts: [reader]
secrets:
- name: greeting
secretRef: { name: greeting }
---
apiVersion: v1
kind: Pod
metadata: { name: ask, namespace: example }
spec:
serviceAccountName: reader
restartPolicy: Never
containers:
- name: ask
image: curlimages/curl
command:
- sh
- -c
- >-
curl -sS --retry 5 --retry-all-errors
-H "Authorization: Bearer $(cat /var/run/secrets/lanyard/token)"
http://lanyard.lanyard-system.svc:8080/v1/secrets/first/greeting
volumeMounts:
- { name: lanyard, mountPath: /var/run/secrets/lanyard, readOnly: true }
volumes:
- name: lanyard
projected:
sources:
- serviceAccountToken: { audience: lanyard, path: token }
kubectl -n example logs ask prints the Secret’s keys, with each
value in base64: {"data":{"message":"aGVsbG8="}}. The pod asked for
the path /v1/secrets/<badge>/<entry>, here the Badge first and its
entry greeting.
In a real workload, copy the lanyard binary into the image and use it
in place of curl. Set LANYARD_URL to lanyard’s
address and LANYARD_TOKEN_FILE to the token’s path. Then
lanyard secret greeting message prints hello. The
set-up-a-workload skill shows
each step.
Skills
skills/ contains a guide for each task, as Agent
Skills:
install: install the service, set up its
atcr.io login, add monitoring, follow releases, and remove it.connect-a-github-app: create
a GitHub App for an owner and declare itsGitHubApp.connect-a-gitea-account:
declare aGiteaAccountfor a Gitea user.connect-an-atproto-account:
declare anAtprotoAccountwith an app password.write-a-badge: decide what a
ServiceAccount’s pods may have.set-up-a-workload: give a pod
its token, the binary, git’s credential helper, and the wrappers for
gh,tea, andtg.troubleshoot: find why an object is
notReadyor a pod is refused.
The repository is its own plugin marketplace. In Claude Code:
claude plugin marketplace add https://tangled.org/guid.foo/lanyard.git
claude plugin install lanyard@lanyard
In Codex:
codex plugin marketplace add https://tangled.org/guid.foo/lanyard.git
codex plugin add lanyard@lanyard
Any other agent that supports Agent Skills can use skills/ directly.
More
The design is in plans/00-design.md.
MIT. See LICENSE.
Report a problem at https://tangled.org/guid.foo/lanyard/issues.