Getting Started
Creating your first Kubernetes Stack with Spacelift, step by step.
Repository Creation
Start by creating a new deployment repository and name the file as deployment.yaml
with the following code:
Looking at the code, you will find that it deploys a single instance of Nginx.
Create a new Stack
In Spacelift, go ahead and click the Add Stack button to create a Stack in Spacelift.
Integrate VCS
Select the repository you created in the initial step, as seen in the picture.
Configure Backend
Choose Kubernetes from the dropdown list and type out the namespace.
Define Behavior
Select the arrow next to Show Advanced Options to expose the advanced configuration options. To ensure the success of a Kubernetes deployment, the following options should be reviewed and validated.
Runner Image: By Default, Spacelift will add the necessary binary to run
kubectl
if not found. Including runner images not provided by Spacelift.Customize workflow: During the initialization phase, you must specify the necessary command to ensure kubeconfig is updated and authenticated to the Kubernetes Cluster you will be authenticating against.
In the example above, I am authenticating to an AWS EKS Cluster and used the following command to update the kubeconfig for the necessary cluster.
aws eks update-kubeconfig --region $region-name --name $cluster-name
The above allows the worker to authenticate to the proper cluster before running the specified Kubernetes deployment in the repository that we created earlier.
Authentication with a Cloud Provider is required. After you Name the Stack, follow the Cloud Integrations section to ensure Spacelift can authenticate to your Kubernetes Cluster.
Name the Stack
Provide the name of your Stack. Labels and Description are not required but recommended.
Saving the Stack will redirect you to its Tracked Runs (Deployment) page.
Configure Integrations
To authenticate against a Kubernetes cluster provided by Cloud Provider managed service, Spacelift requires integration with the associated Cloud Provider.
Navigate to the Settings, Integrations page and select the dropdown arrow to access the following selection screen:
Necessary permissions to the Kubernetes Cluster are required.
The following links will help you set up the necessary integration with your Cloud Provider of choice.
Once you have configured the necessary integration, navigate the Stack landing page and Trigger a Run.
Trigger a Run
To Trigger a Run, select Trigger on the right side of the Stacks view.
Triggered Run Status
Please review the documentation for a detailed view of each Run Phase and Status associated with Kubernetes.
Unconfirmed
After you manually trigger the Run in the Stack view, Spacelift will deploy a runner image, initialize the Cloud Provider, Authenticate with the Kubernetes Cluster and run the Deployment specified in the repository. After a successful planning phase, you can check the log to see the planned changes.
To confirm the Triggered run, click the CONFIRM button.
Finished Deployment
The following screen highlights the Finished Run and output from a successful deployment to your Kubernetes cluster.
Default Removal of Deployments
Last updated
Was this helpful?