Set up a Bastion
Register a Bastion on the main installation, give it a token, install its chart and check that it serves.
On this page
| Where | What you need |
|---|---|
| Main installation | A registration and its token; the Bastion's address in server.additional_base_urls |
| Bastion's namespace | The token's Secret; a TLS source for its listener (cert-manager or a Secret); a public name and certificate on its ingress |
| Network | The Bastion reaches the main installation's endpoint on port 443; the main installation never connects to the Bastion |
Declare the Bastion in the values
- Who
- whoever runs the main installation's Helm release
For an installation run from Git: the registration then survives a fresh database.
- Make the token's value once with
quader admin bastion token generate; a random string is no Bastion token. - Put the value into a Secret in both namespaces: the main installation's, for its migration Job, and the Bastion's, for
secrets.mainToken. The charts never create a Secret. - Declare it in the values of the chart
quaderand roll out:
bastions:
declared:
# example; lower-case letters, digits and -, at most 20 characters
- name: partners
description: Partner access # example
# example; the addresses the Bastion connects from
egress: [198.51.100.16/28]
token:
existingSecret: quader-bastion-token # example
key: token # default
The migration Job creates the registration or brings it in line; a missing Secret or a wrong value stops it before any pod rolls.
The card marks such a registration Helm configuration: its description, addresses, token and Delete are greyed out, each
naming bastions.declared. The declared token never expires; Rotate token is unavailable. Invalidate stops a leaked token; the next
upgrade then stops at its migration Job until the Secret holds a new value. Switches and limits stay yours, but a fresh database resets them.
Rotate by putting a new value into both Secrets, the Bastion's first, and rolling out the main installation: its Job revokes the old value at once, for good. Take a declaration out to manage the registration on the screen: the next Job revokes its token and keeps the registration. After a restore, see After the restore.
Register it on the screen
- Who
endpoints:write(admin, security-admin) to act;endpoints:readto see the screen
- Admin area › Bastions › New Bastion: a Name as above, which cannot change, and a Description.
- In the card's section Tokens, Issue token: a Description and a Lifetime in days (empty is
auth.tokens.bst.default_ttl). A Bastion token always expires. - Copy the token from Your new token; it is shown once. Put it into the Bastion's Secret:
# example: the namespace and the Secret's name
kubectl -n quader-bastion create secret generic quader-bastion-token \
--from-literal=token='qdr_bst_…'
A registration holds at most three unrevoked tokens by default
(auth.tokens.max_active_per_principal.bst), enough for a renewal with an overlap
(Renew the token). Bastion tokens show only on the card, never on the Tokens screen.
The addresses a Bastion connects from
The main installation believes the client address and host a Bastion forwards only from the networks its card lists under Addresses this Bastion connects from. Then its limits, blocks and audit trail apply to each client.
Without a listed address every client through the Bastion counts as the Bastion: one budget, one block, and the Bastion's address in
the audit log. After the first contact the card's Limits warns with the address each replica came from and offers Add
198.51.100.21 (example). Check it first: a stolen token would show the same. QuaderBastionCallersPooled fires after
15 minutes of such requests.
Edit the list under Details: an address, or a network such as 198.51.100.16/28, at most 32. A network covering every address is
refused. Never list the address in server.trusted_proxies too: that trusts it for every request. A restore to an earlier point
never brings back an address removed since.
Settings on the main installation
config:
server:
# example: the Bastion's config.server.base_url
additional_base_urls: ["https://packages.example.com"]
The entry must equal the Bastion's config.server.base_url (scheme, host, port). With it the main installation writes every address
for the Bastion on the Bastion's host, and Set up client offers the Bastion. Without it the Bastion refuses to serve rather than
hand out the main installation's addresses.
Choose what it distributes
- Who
- administrators allow projects (
endpoints:write); the project's Owner chooses repositories
- On the card, open Projects, type into Allow a project, choose it and Allow. A new Bastion allows none.
- The project's Owner ticks the Bastion in a repository's Settings › Visibility › Bastions (Distribute a repository); Distributed here lists it.
Remove takes a project off with its Owners' choices. A repository moved to another project loses its choices. For ClamAV
updates through the Bastion, allow upstream and distribute upstream/clamav.
Install the chart
The chart quader-bastion has the version of the chart quader (its values).
config:
server:
# example: the Bastion's public address
base_url: https://packages.example.com
# example: the pods of its ingress controller; required with the Ingress
trusted_proxies: ["10.244.0.0/16"]
bastion:
main:
# example: the main installation's endpoint
url: https://quader.example.com
secrets:
mainToken:
existingSecret: quader-bastion-token # example
tls:
certManager:
issuerRef:
name: internal-ca # example; or tls.existingSecret
# example: the version of the main installation
helm install quader-bastion quader/quader-bastion -n quader-bastion \
-f values.yaml --version <version>
This runs two replicas across nodes, each with its own cache on an ephemeral volume and its share of every limit. Both URLs must be
https; give a private CA with trustedCA. The chart's network policy admits only incoming traffic. Restrict the Bastion's outgoing
traffic yourself: DNS, the main installation, its own Valkey, a cache bucket and a span collector, nothing else.
For clients that depend on it, share the cache and the counters:
| Value | What it changes |
|---|---|
config.bastion.cache.backend: bucket |
One cache in a bucket for every replica, kept across restarts; needs secrets.signingKey and secrets.cacheBucket |
cacheVolume.type: persistent, routeByPath: true |
A volume per pod, HAProxy Ingress routing a path to one replica; not with the bucket |
config.valkey.mode: sentinel |
Limits, blocks and answers shared through a Valkey of its own (below) |
secrets.cacheKey |
Every cached object encrypted; a new key empties the cache |
config.bastion.cache.max_bytes, max_object_bytes, spool_max_bytes |
The cache's size; a larger file passes through uncached, so raise them for large image layers |
A Valkey of the Bastion's own
Optional: without it each replica counts its share alone. Never the main installation's Valkey: it carries a mark, and a Bastion that
finds it writes nothing there, counts per replica, and QuaderBastionValkeyRefused fires. The chart requires secrets.valkey, since
whoever reaches a Valkey without a password can block any address. The recommended way to run it is the
guided-traffic valkey-operator, with TLS and Sentinel failover:
apiVersion: v1
kind: Secret
metadata:
name: quader-bastion-valkey-password # example
namespace: quader-bastion
annotations:
# filled by the guided-traffic internal-secrets-operator;
# or put a password of your own under "password"
iso.gtrfc.com/autogenerate: password
type: Opaque
---
apiVersion: vko.gtrfc.com/v1
kind: Valkey
metadata:
name: quader-bastion-valkey # example
namespace: quader-bastion
spec:
replicas: 2
image: valkey/valkey:9.2-alpine
sentinel: {enabled: true, replicas: 3}
auth: {secretName: quader-bastion-valkey-password}
tls:
enabled: true # 16379 and Sentinel 36379; plain ports closed
unifiedCertificate: true
certManager:
issuer: {kind: ClusterIssuer, name: internal-ca} # example
podDisruptionBudget: {enabled: true}
antiAffinity: {mode: hard}
networkPolicy: {enabled: true} # between the operator's own pods
resources:
requests: {cpu: 50m, memory: 64Mi}
# a starting point: a flood from very many addresses grows the data
limits: {memory: 256Mi}
---
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: quader-bastion-valkey-clients
namespace: quader-bastion
spec:
podSelector:
matchLabels:
app.kubernetes.io/instance: quader-bastion-valkey
app.kubernetes.io/managed-by: vko.gtrfc.com
policyTypes: [Ingress]
ingress:
- from:
- podSelector:
matchLabels:
app.kubernetes.io/name: quader-bastion
# example: the Bastion's release
app.kubernetes.io/instance: quader-bastion
ports:
- {port: 16379, protocol: TCP}
- {port: 36379, protocol: TCP}
config:
valkey:
mode: sentinel
sentinel:
# example: three or more, the operator's Sentinels
addresses:
- quader-bastion-valkey-sentinel-0.quader-bastion-valkey-sentinel-headless.quader-bastion.svc.cluster.local:36379
primary_name: quader-bastion-valkey # example
secrets:
signingKey:
existingSecret: quader-bastion-signing # example: 32 random bytes
valkey:
existingSecret: quader-bastion-valkey-password # example
usernameKey: "" # the default user
valkeySentinel:
existingSecret: quader-bastion-valkey-password # example
usernameKey: ""
valkeyCA:
existingSecret: quader-bastion-valkey-tls # or the CA in trustedCA
Several Bastions may share one Valkey server: each writes under the host of its base URL.
Several deployments with one token
Deployments in several clusters may share one registration and token, each with its own config.server.base_url, cache, Valkey and
Ingress. List every base URL in additional_base_urls and every network they connect from on the card. The deployments heard within
three minutes share the registration's anonymous ceiling, slots and throughput equally
(Limits and blocking).
A Docker Engine mirror through a Bastion
A Bastion serves a Docker Engine mirror (on a bound host) when
its base URL is a host of endpoints.default.hostRoots of the chart quader, such as {mirror.example.com: web/docker-hub}
(example). One Bastion release serves one bound host.
Verify
- Within a minute of the start the card's head says Connected, followed by the host its replicas reported; it must be your
base_url. Replicas lists each replica, the address the main installation saw, its version and its last contact. - The Replicas line says how the limits count:
| The line | Means |
|---|---|
| "… · limits shared through Valkey" | The replicas count together |
| "… · limits per replica" | No Valkey: each replica counts its share alone |
| "Valkey unreachable: the replicas count their limits alone." | Check the Valkey |
| "The configured Valkey is the main installation's; this Bastion does not use it." | Configure a Valkey of its own and roll out |
- From outside your network, read a package with the snippets of Set up client; a second read comes from the cache.
Metrics and alerts: Run a Bastion.