Article · 8 min read · Getting started
Connect a cloud account
kubespin can make servers in your own AWS, DigitalOcean, Hetzner Cloud, IONOS Cloud, Google Cloud and Azure accounts. Each cloud bills you directly; kubespin only uses the access you give it.
kubespin can make servers in your own AWS, DigitalOcean, Hetzner Cloud, IONOS Cloud, Google Cloud and Azure accounts. Each cloud bills you directly; kubespin only uses the access you give it.
You can connect as many accounts as you like, including several of the same cloud (one per client, say). Give each a name so you can tell them apart.
Adding one
Clouds › Add cloud walks you through four steps:
-
Choose the cloud.
-
Give kubespin its own identity there. Never your own sign-in or the account’s root user:
Cloud What you make AWS an IAM user called kubespin, with only the kubespin policy (shown to copy) DigitalOcean a token with custom scopes, in a team of its own, expiring in 90 days Hetzner Cloud a project called kubespin, and a Read & Write token in it IONOS Cloud a user called kubespin, in a group with Create data center only Google Cloud a service account with Compute Instance Admin (v1) and Service Account User Azure an app registration with Virtual Machine Contributor and Network Contributor on a resource group called kubespin -
Paste the key for that identity and press Check. kubespin says what it found, what the key can and can’t do, and warns if it can do more than kubespin needs. Root and owner keys are refused.
-
Defaults: the region to use first, a name, and whether its costs show on the dashboard.
AWS, step by step
kubespin needs an IAM user with an access key. It doesn’t need an admin user, IAM Identity Center, or any group.
- Sign in to the AWS console as an administrator, or as the root user if that’s all you have. These steps are a one-off, which AWS allows from root. If the console suggests IAM Identity Center, skip it: that’s for people signing in, not for kubespin.
- Make the policy: IAM › Policies › Create policy › JSON. Paste the policy kubespin
shows under Show the permissions, name it
kubespin, and create it. - Make the user: IAM › Users › Create user, named
kubespin.- Leave Provide user access to the AWS Management Console unticked.
- On Set permissions, choose Attach policies directly (not Add user to group), tick
kubespin, and nothing else. No groups.
- Make an access key: open the
kubespinuser › Security credentials › Create access key › Application running outside AWS. Paste the access key ID and secret into kubespin and press Check. - If you used the root user: turn on MFA for it (account menu › Security credentials), and stop using it.
To use the AWS console yourself from now on, make yourself an admin: either an IAM user with console access, the AdministratorAccess policy attached directly and MFA, or a user in IAM Identity Center with the AdministratorAccess permission set, which AWS recommends for teams.
Afterwards
- Keys are stored encrypted and never shown again. Settings › Replace the key checks the new key belongs to the same account before using it.
- kubespin reminds you to replace a key a week before it expires, and every 90 days for keys that never expire.
- Disconnect forgets the key. Nothing in the cloud is changed or deleted.
Making a server in a cloud
Servers › Add server lists your connected clouds first. Choose one, then the region and size (the cheapest is chosen for you), give it a name and press Create server. You can add your own start-up script: it runs once, as root, after the server has joined kubespin.
kubespin makes the server with Debian 12 and a firewall that lets in only web traffic (80 and 443). It joins kubespin by itself in a few minutes, over the agent’s tunnel, and appears under Servers. Each cloud’s servers are listed on Clouds, where you can switch them off and on, or delete them. Deleting a server kubespin made deletes it in the cloud too; its apps are kept so you can put them on another server.
Throwaway servers
Tick Throwaway when adding a server for something you don’t need to keep: a test, a build, a demo. If it goes (the cloud takes it back, or it stops answering for 10 minutes), it shows Gone on Clouds and its apps wait. Recreate deletes whatever is left of it and makes the same server again, in the same place with the same size, name and script, and its apps move there. Data on it isn’t kept: apps start empty, or from their backups.
A throwaway server stays on while it’s there; delete it when you’re done. Recreate also works on a server that failed to start or join.
Deleting a cloud server asks you to type its name.
Switching idle servers off
Tick Switch off when nobody has used it for 4 hours when you make a server, or choose 1, 4, 12 or 24 hours (or Always on) on its row under Clouds. Once nobody has visited its apps through a kubespin name for that long:
- AWS, Google Cloud, Azure: it’s stopped and the disk is kept. A visit starts it again in about a minute.
- DigitalOcean, Hetzner, IONOS: these clouds bill servers that are switched off, so it’s deleted, disk and all. A visit makes a fresh one in the same place within a few minutes, and its apps start there. Keep app data in backups.
While it starts, visitors see a “Starting” page that reloads by itself.
AWS Auto Scaling groups
On Clouds, an AWS account has New Auto Scaling group (or choose an Auto Scaling group under Add server). The set-up asks one thing a step: name, region and processor; spot or on-demand; instance types, with today’s spot prices; how many, and whether to follow CPU. The last step lists what is made in AWS and roughly what it costs.
- Spot instances are spare AWS capacity at up to 70% off. AWS can take one back with two minutes’ notice; the group starts another and its apps move there.
- The first group in a region makes a network for kubespin and an edge: one small on-demand instance with an Elastic IP (about US$6.70 a month together). The group’s instances have private addresses only and reach the internet through the edge, so there’s no NAT gateway or load balancer to pay for. Every group in the region shares it; it’s released with the last one.
- Put apps on the group by moving them to asg: under Servers › Auto-join.
The group’s page has a tab for each part. On Launch template, change the image, disk or your script and press Save as version N: new instances use it and nothing restarts. Replace instances now swaps the running ones for new ones, keeping half running.
An S3 bucket for backups
On Clouds, an AWS account has New bucket. Its name starts kubespin-; bucket names are
shared by everyone on S3, so choose something of your own. kubespin sets it up to cost as little as
S3 can: files nobody reads move to cheaper storage by themselves, it’s encrypted and private, and
there are no versions or logs to pay for.
To copy a WordPress site’s backups there, open the site’s Backups, press Change, and choose
the bucket under In S3. Copies are encrypted with your backup key before they leave kubespin,
so open them with your recovery key and kubespin-decrypt.py, as with OneDrive.
Tick Let this region’s Auto Scaling groups use it and their instances can read and write that bucket (and no other) without a key.
What your clouds cost
The dashboard’s Clouds this month card shows, for each cloud account with Show its costs on the dashboard ticked, what it has cost so far this month and roughly what it will by the month’s end, the servers and groups costing most, and what spot instances and switching idle servers off saved. kubespin reads the figures once a day; Read again reads them now (at most once an hour, as AWS charges a cent a read).
- AWS figures come from Cost Explorer, split by the
kubespintag on everything kubespin makes. kubespin turns that tag on for cost reports for you; AWS takes a day to show costs by it. The kubespin user needsce:GetCostAndUsageandce:UpdateCostAllocationTagsStatus(both in the policy shown when you add or replace a key). - DigitalOcean figures are the month-to-date usage on your balance.
- Azure figures come from Cost Management on the
kubespinresource group. Give the key the Cost Management Reader role there; until then they’re estimated. - Hetzner, Google Cloud and IONOS are estimated: each server’s price for the hours it was on. Hetzner has no billing API, Google’s needs a BigQuery export, and IONOS’s needs the contract owner, which kubespin’s user isn’t.
Each cloud server on Clouds shows its cost this month and its price an hour; a bucket’s page shows what it has cost this month.