The following is a guide to how to create an application.
First, you create and configure an application declaration. This declaration can be deleted after applying it. You'll be making changes to the Kubernetes and ArgoCD resources from that point on.
- We apply the application declaration to the IAC repository, which converts the application declaration to resources understood by Kubernetes and ArgoCD.
For a complete example, you can check out this guide.
If you need information on how to make your Docker images available in the cluster, see Running a Docker image in your cluster
Commands
To scaffold an application.yaml template, run the following command:
# Syntax
okctl --cluster-declaration=<relevant cluster.yaml> scaffold application
# Example
okctl --cluster-declaration=cluster.yaml scaffold application > application.yaml
This creates an application declaration in application.yaml
.
Usage
After configuring the application.yaml
file, you turn it into Kubernetes and ArgoCD resources by running:
# Syntax
okctl --cluster-declaration=<relevant cluster.yaml> apply application -f <relevant application.yaml>
# Example
okctl --cluster-declaration=cluster.yaml apply application -f application.yaml
This next command will create the following content in the infrastructure folder:
infrastructure/applications/APP-NAME/base
(contains Kubernetes resources common for your application regardless of the environment).infrastructure/applications/APP-NAME/overlays
(contains (Kustomize) patches containing environment-specific adjustments to the common resources).
After that, the following manual step remains:
Commit and push the changes done by okctl apply application
to your infrastructure as code repository remote making them accessible for ArgoCD.
Your application should now return a status code between 200 and 400 on "/". If this is not the case, make sure to configure the liveness and readiness probes in the <app-name>/base/deployment.yaml
file.