NashTech Blog

Keptn: Creating Your First Project

Creating a project in Keptn is straightforward, but it opens up a world of possibilities for automating your delivery processes. Creating your first project with Keptn is an exciting milestone. This blog will guide you through the process of setting up a new project in Keptn, adding services, and deploying an application.

Step 1: Understand the Keptn Model

Keptn projects are structured around a simple but powerful model:

  • Project: Represents a set of services and stages.
  • Stage: Defines different environments like dev, staging, and production.
  • Service: Represents the microservices within a project.

Before creating a project, you need to define a shipyard file—a YAML file that outlines your stages and their sequences (e.g., delivery, tests, evaluations).

Step 2: Create the Shipyard File

Here’s a basic example of a shipyard file:

apiVersion: 'spec.keptn.sh/0.2.0'
kind: 'Shipyard'
metadata:
name: 'simple-project'
spec:
stages:
- name: 'dev'
sequences:
- name: 'delivery'
tasks:
- name: 'deployment'
- name: 'test'
- name: 'evaluation'
- name: 'production'
tasks:
- name: 'deployment'
- name: 'evaluation'

This file defines two stages, dev and production, with a simple delivery sequence that includes deployment, testing, and evaluation tasks.

Step 3: Create the Project

To create the project using the Keptn CLI, run:
$ keptn create project simple-project --shipyard=./shipyard.yaml

Replace simple-project and shipyard.yaml with your project name and shipyard file path.

Step 4: Add a Service to Your Project

Next, you’ll need to add a service to your project:
$ keptn create service my-service --project=simple-project

This command creates a new service named my-service within your project.

Step 5: Deploy Your Application

With the service in place, you can deploy your application using Helm charts. First, package your Helm chart:
$ helm package ./chart

Then deploy it using:
$ keptn add-resource --project=simple-project --service=my-service --all-stages --resource=./chart-0.1.0.tgz --resourceUri=helm/chart.tgz
$ keptn trigger delivery --project=simple-project --service=my-service --image=my-docker-image:latest


This triggers the delivery process, deploying your application according to the shipyard file.

Step 6: Monitor the Deployment

Finally, you can monitor the deployment process using the Keptn Bridge or by checking the status via the CLI:
$ keptn get event --project=simple-project

Conclusion

Creating a project in Keptn is straightforward, but it opens up a world of possibilities for automating your delivery processes. Creating your first project with Keptn is an exciting milestone. It marks the beginning of automating your delivery pipelines and introducing standardized, scalable processes into your development workflow. With a project in place, you can now focus on refining your sequences, adding more services, and expanding your stages to cover different environments. The flexibility and power of Keptn make it easier than ever to manage complex delivery pipelines while ensuring quality and consistency across deployments. As you gain more experience with Keptn, you’ll be able to explore advanced features like automated testing, continuous performance monitoring, and intelligent remediation.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top