KiteGitHub
Quickstart

Set up a node pool

Connect GCP, AWS or DigitalOcean, create a NodeClass and NodePool, and check that the pool creates a node.

Connect a Google Cloud, AWS or DigitalOcean account to your cluster. Then create a node pool, which creates a machine in that account when a pod does not fit on any node.

What you need

  • The Kite CLI, signed in to the cluster, and kubectl pointed at the same cluster.
  • A network at the provider where machines can connect to the cluster’s address on port 443, and to each other on UDP port 51820. Its addresses must not overlap the pod and Service ranges.

Connect a cloud account

For each provider, kite nodepool connect writes a setup script. The script creates what the control plane needs to sign in to your account, and applies a NodeClass. A NodeClass contains the provider settings that a pool uses to create machines.

Google Cloud

The control plane signs in to Google Cloud with Workload Identity Federation, so you don’t create a service-account key. Sign in to the Google Cloud CLI as a principal that can create a workload identity pool, a provider, a service account, and role bindings.

Write the setup script. It stops at the first command that fails, so choose a workload identity pool name and a provider name that the project does not use yet:

export GCP_PROJECT=my-project
export GCP_ZONE=us-central1-a
export GCP_WIP_POOL=kite
export GCP_WIP_PROVIDER=kite
export GCP_NODE_SERVICE_ACCOUNT=kite-node
export NODECLASS=gce
export POOL_NAME=gcp-workers

kite nodepool connect gcp \
  --project "$GCP_PROJECT" \
  --zone "$GCP_ZONE" \
  --pool "$GCP_WIP_POOL" \
  --provider-id "$GCP_WIP_PROVIDER" \
  --service-account "$GCP_NODE_SERVICE_ACCOUNT" > kite-gcp-connect.sh

To use another VPC, add network and subnetwork under gcp in the script.

Read the script, then run it with bash kite-gcp-connect.sh. It creates the workload identity pool, the provider, the service account and the role bindings, and applies a NodeClass named gce. Check the class:

kite nodepool verify "$NODECLASS"

It prints ok gce when the class works. Otherwise it prints the step that failed and what to change.

AWS

The control plane assumes an IAM role with a token that it signs itself, so you don’t create an access key. Sign in to the AWS CLI as a principal that can create an OIDC identity provider, roles, an instance profile, and a role policy.

Write the setup script. Choose a role name and an instance profile name that the account does not use yet.

The role lets the control plane launch an instance, delete it and read its console only when the instance has your cluster’s name as a tag. kite nodepool connect aws reads that name from the cluster when it writes the script. See Share a cloud project between clusters.

export AWS_REGION=us-east-1
export AWS_ROLE=kite-nodepool
export AWS_INSTANCE_PROFILE=kite-node
export NODECLASS=ec2
export POOL_NAME=aws-workers

kite nodepool connect aws \
  --region "$AWS_REGION" \
  --role "$AWS_ROLE" \
  --instance-profile "$AWS_INSTANCE_PROFILE" \
  --class "$NODECLASS" > kite-aws-connect.sh

To use your own VPC, add subnets and securityGroups under aws in the script. Without them, machines launch into each zone’s default subnet with the VPC’s default security group.

Read the script, then run it with bash kite-aws-connect.sh. It creates the OIDC identity provider, the roles and the instance profile, and applies a NodeClass named ec2. Check the class with kite nodepool verify "$NODECLASS".

DigitalOcean

Create a custom-scoped DigitalOcean API token with these scopes:

ResourceRequired scopes
Dropletsdroplet:create, droplet:read, droplet:delete
Capacitysizes:read, regions:read
Tagstag:create

Write the setup script:

export DO_SECRET=digitalocean-production
export DO_REGION=nyc3
export NODECLASS=droplet
export POOL_NAME=do-workers

kite nodepool connect digitalocean \
  --region "$DO_REGION" \
  --secret "$DO_SECRET" \
  --class "$NODECLASS" > kite-digitalocean-connect.sh

To use another VPC, add vpc under digitalocean in the script.

Read the script, then run it with bash kite-digitalocean-connect.sh. It asks for the token, stores it in the Secret $DO_SECRET in kube-system, and applies the NodeClass. To store the Secret in another namespace, pass --namespace to kite nodepool connect. Check the class with kite nodepool verify "$NODECLASS".

If kubectl create secret reports that the Secret exists, check which account its token belongs to before you replace it.

Create a pool

Create a pool for the class, with at most three machines and six vCPUs:

kubectl apply -f - <<EOF
apiVersion: kiteplane.dev/v1alpha1
kind: NodePool
metadata:
  name: ${POOL_NAME}
spec:
  nodeClassRef:
    name: ${NODECLASS}
  limits:
    nodes: "3"
    cpu: "6"
EOF

Check that the pool creates a node

Create a pod that can run only on a node from the new pool:

kubectl apply -f - <<EOF
apiVersion: v1
kind: Pod
metadata:
  name: nodepool-check
spec:
  nodeSelector:
    kiteplane.dev/nodepool: ${POOL_NAME}
  containers:
    - name: web
      image: nginx:1.27
      resources:
        requests:
          cpu: 100m
          memory: 128Mi
EOF

kubectl get nodeclaims -w

The pool creates a NodeClaim for each new machine. When a NodeClaim appears, stop the watch and check the claim, the node, and the pod:

kubectl describe nodeclaim <claim-name>
kubectl get nodes -l "kiteplane.dev/nodepool=${POOL_NAME}"
kubectl get pod nodepool-check

The claim’s Launched condition becomes True, its phase becomes Registered, and a Ready node with the pool’s label appears. When the pod is Running, the pool works. Delete the pod:

kubectl delete pod nodepool-check

If no node appears

kubectl get nodeclasses,nodepools,nodeclaims
kubectl describe nodepool <pool-name>
kubectl describe nodeclaim <claim-name>

Check these in order:

  1. kite nodepool verify <nodeclass> passes.
  2. The pool is below its limits, and its labels, taints, and machine types fit the pending pod.
  3. The claim has Launched=True. If not, its message says which setting to fix. If the provider had no capacity for the machine, read status.unavailable on the pool.
  4. The claim has Registered=True within the pool’s registrationTimeout, ten minutes by default. If not, the controller deletes the claim and its machine, and the pool’s RegistrationTimeout event holds the last lines that the machine’s startup script printed to its console. Also check that the machine can connect to the cluster’s address.
  5. The node is Ready, and the pod’s events show no scheduling or mount failure.

Delete the pool

Delete the pool, not its claims or nodes. Kite drains and deletes the pool’s machines, and the pool stays until the provider no longer lists any of them:

kubectl delete nodepool "$POOL_NAME"

kubectl delete waits until the pool is gone. Draining each node takes up to the pool’s spec.disruption.terminationGracePeriod, 5 minutes by default. If the command is still waiting after that, read the pool’s events:

kubectl describe nodepool "$POOL_NAME"

A MachinesUnlisted event says why Kite cannot list the machines, such as a credential that no longer works. Fix the cause, and the delete finishes. If you remove the finalizer kiteplane.dev/termination from the pool instead, the pool is deleted, but its machines keep running.

To check the provider yourself, you need the cluster’s name, which the deployment’s settings file contains. For the default deployment, kite-control, run:

export KITE_CLUSTER=$(sed -n 's/^KITE_CLUSTER=//p' ~/.kite/deployments/kite-control/deploy.env)

If the file has no KITE_CLUSTER line, the cluster is named kite. Then check that the provider lists none of the pool’s machines:

Google Cloud

This list must be empty:

gcloud compute instances list \
  --project="$GCP_PROJECT" \
  --zones="$GCP_ZONE" \
  --filter="labels.kite-cluster=${KITE_CLUSTER} AND labels.kite-pool=${POOL_NAME}"

AWS

This list must be empty:

aws ec2 describe-instances --region "$AWS_REGION" \
  --filters "Name=tag:kite-cluster,Values=${KITE_CLUSTER}" "Name=tag:kite-pool,Values=${POOL_NAME}" \
    "Name=instance-state-name,Values=pending,running,stopping,stopped" \
  --query 'Reservations[].Instances[].InstanceId'

DigitalOcean

Wait until no droplet has both the tags kite-cluster:${KITE_CLUSTER} and kite-pool:${POOL_NAME}.

Check that no other pool uses the class, then delete the class:

kubectl get nodepools -o custom-columns=NAME:.metadata.name,CLASS:.spec.nodeClassRef.name
kubectl delete nodeclass "$NODECLASS"

Remove the provider’s trust resources

Google Cloud

Run these only when nothing else uses the workload identity pool, provider, or service account:

export GCP_PROJECT_NUMBER="$(gcloud projects describe "$GCP_PROJECT" --format='value(projectNumber)')"
export GCP_NODE_PRINCIPAL="principal://iam.googleapis.com/projects/${GCP_PROJECT_NUMBER}/locations/global/workloadIdentityPools/${GCP_WIP_POOL}/subject/system:kite:nodepool"

gcloud projects remove-iam-policy-binding "$GCP_PROJECT" \
  --member="$GCP_NODE_PRINCIPAL" \
  --role="roles/compute.instanceAdmin.v1"
gcloud iam service-accounts remove-iam-policy-binding \
  "${GCP_NODE_SERVICE_ACCOUNT}@${GCP_PROJECT}.iam.gserviceaccount.com" \
  --project="$GCP_PROJECT" \
  --member="$GCP_NODE_PRINCIPAL" \
  --role="roles/iam.serviceAccountUser"
gcloud iam service-accounts delete \
  "${GCP_NODE_SERVICE_ACCOUNT}@${GCP_PROJECT}.iam.gserviceaccount.com" \
  --project="$GCP_PROJECT"
gcloud iam workload-identity-pools providers delete "$GCP_WIP_PROVIDER" \
  --project="$GCP_PROJECT" \
  --location=global \
  --workload-identity-pool="$GCP_WIP_POOL"
gcloud iam workload-identity-pools delete "$GCP_WIP_POOL" \
  --project="$GCP_PROJECT" \
  --location=global

AWS

Run these only when nothing else uses the roles, the instance profile, or the OIDC provider. Set KITE_ISSUER to the issuer that kite nodepool verify prints:

export AWS_ACCOUNT="$(aws sts get-caller-identity --query Account --output text)"
aws iam remove-role-from-instance-profile \
  --instance-profile-name "$AWS_INSTANCE_PROFILE" --role-name "$AWS_INSTANCE_PROFILE"
aws iam delete-instance-profile --instance-profile-name "$AWS_INSTANCE_PROFILE"
aws iam delete-role --role-name "$AWS_INSTANCE_PROFILE"
aws iam delete-role-policy --role-name "$AWS_ROLE" --policy-name machines
aws iam delete-role --role-name "$AWS_ROLE"
aws iam delete-open-id-connect-provider \
  --open-id-connect-provider-arn "arn:aws:iam::${AWS_ACCOUNT}:oidc-provider/${KITE_ISSUER#https://}"

DigitalOcean

Check that no other NodeClass refers to the same Secret, then delete the Secret:

kubectl get nodeclasses \
  -o custom-columns=NAME:.metadata.name,SECRET:.spec.digitalocean.credentialsSecretRef.name,NAMESPACE:.spec.digitalocean.credentialsSecretRef.namespace
kubectl delete secret "$DO_SECRET" --namespace=kube-system

Next