Article · 4 min read · Apps and Kubernetes
kubespin: Architecture of an app
What an app is in kubespin, where its parts live, and what kubespin does around it.
What an app is in kubespin, where its parts live, and what kubespin does around it.
The parts
An app is a Docker Compose project on one of your servers. It can come from:
- a GitHub repository (kubespin: Deploy an app from Git);
- the Apps catalogue (kubespin: Install a ready app);
- a compose file you paste, or a single container image.
WordPress sites are apps with a fixed shape of their own: see kubespin: Architecture of a WordPress site.
On the server, each app has:
- its own folder, holding the code (for Git apps) and the compose files;
- its containers, one per Compose service, labelled with the Compose project so kubespin can find them;
- named volumes for its data;
- a port that kubespin puts on the app’s HTTPS address. For ready apps and WordPress sites, kubespin picks a free port on the server. For an app from Git, it’s detected from the ports the compose file publishes, or you give it as the Proxy port.
Where its images come from
Images come from your area of kubespin’s registry, pinned by digest, not from Docker Hub directly:
- images an app names are copied into your area, scanned and, where an OS package has a fix, patched;
- images an app builds from Git are built on the server, or on a bigger server of yours for a small one (kubespin: Build an app on another server), and pushed to your area.
Every deploy uses the registry copy once it’s ready. See kubespin: The local container registry.
How it’s reached
kubespin publishes the app’s port on an HTTPS address. There are three ways, chosen per app: see kubespin: How traffic reaches an app.
A private app gets no public address at all. You reach it over an SSH tunnel.
Settings and secrets
Environment variables live in kubespin and are written to the server at each deploy. Secret ones are sealed in kubespin’s database and reach the server on standard input. See kubespin: Secrets and encryption.
What kubespin does around it
| When | What |
|---|---|
| Each deploy | Checks there’s room on the disk, pulls or builds, starts, scans the new images. It carries on if kubespin restarts (kubespin: Runs, logs and kubespin restarts). |
| On a schedule or webhook | Updates from Git (kubespin: Schedules and webhooks) |
| Maintenance hour | Rolls out patched images, checks the app comes up, moves back if it doesn’t |
| Weekly | Scans every image; tidies unused images and old build cache |
| Always | Collects memory and CPU per container; you can set memory limits (kubespin: Small servers) |
On a Kubernetes cluster
A server can also run a single-node Kubernetes cluster, on kind, Colima or Kiri (kubespin: Clusters on kind, Colima or Kiri). In New deployment, Where it runs offers a kind cluster. The compose file becomes Kubernetes objects in the app’s own namespace: Deployments, Services, volume claims, a Secret for its secret settings and an Ingress. Anything that can’t run on a cluster (host networking, privileged containers, the server’s own files) is refused before anything changes.
Each kubeconfig kubespin gives out is its own certificate and can be revoked from the cluster’s page. To reach the cluster with kubectl, k9s and helm from any computer, see kubespin: Reach a cluster with kubectl, k9s and helm.