Deploy a Sample App from DKP GitOps
Use this procedure to deploy a sample podinfo
application from DKP Enterprise GitOps.
Prerequisites
Github account and personal access token
Deployment Steps
This procedure was run on an AWS cluster with DKP installed.
Follow these steps:
Ensure you are on the Default Workspace (or other workspace you have access to) so that you can create a project.
Create a project.
In the working example we name the project pod-info. When you create a namespace, Kommander appends five alphanumeric characters. You can opt to select a target cluster for this project from one of the available attached clusters, and then this (pod-info-xxxxx) is the namespace used for deployments under the project, for example:[Optional] Create a secret in order to pull from the repository, for private repositories.
Select the Secrets tab and set up your secret according to the Continuous Deployment documentation.
Add a key and value pair for the GitHub personal access token and then select Create.
Verify that the secret
podinfo-secret
is created on the project namespace in the managed or attached cluster:CODEkubectl get secrets -n pod-info-xt2sz --kubeconfig=${CLUSTER_NAME}.conf
CODENAME TYPE DATA AGE default-token-k685t kubernetes.io/service-account-token 3 94m pod-info-xt2sz-token-p9k5z kubernetes.io/service-account-token 3 94m podinfo-secret Opaque 1 1s tls-root-ca Opaque 1 93m
Select your project and then select the CD tab.
Add a GitOps Source, complete the required fields, and then Save.
There are several configurable options such as selecting the Git Ref Type but in this example we use the master branch. The Path value should contain where the manifests are located. Additionally, the Primary Git Secret is the secret (podinfo-secret) that you created in the previous step, if you need to access private repositories. This can be disregarded for public repositories.Verify the status of
gitrepository
creation with this command (on the attached or managed cluster), and if READY is marked as True:
CODEkubectl get gitrepository -A --kubeconfig=${CLUSTER_NAME}.conf
CODENAMESPACE NAME URL AGE READY STATUS kommander-flux management https://gitea-http.kommander.svc/kommander/kommander.git 134m True stored artifact for revision 'main/4fbee486076778c85e14f3196e49b8766e50e6ce' pod-info-xt2sz podinfo-source https://github.com/stefanprodan/podinfo 116m True stored artifact for revision 'master/b3b00fe35424a45d373bf4c7214178bc36fd7872'
Verify the
Kustomization
with this command below (on the attached or managed cluster), and if READY is marked as True:CODEkubectl get kustomizations -n pod-info-xt2sz --kubeconfig=${CLUSTER_NAME}.conf
CODENAME AGE READY STATUS originalpodinfo 10m True Applied revision: master/b3b00fe35424a45d373bf4c7214178bc36fd7872 podinfo-source 113m True Applied revision: master/b3b00fe35424a45d373bf4c7214178bc36fd7872 project 116m True Applied revision: main/4fbee486076778c85e14f3196e49b8766e50e6ce project-tls-root-ca 117m True Applied revision: main/4fbee486076778c85e14f3196e49b8766e50e6ce
Note the port so that you can use to verify if the app is deployed correctly (on the attached or managed cluster):
CODEkubectl get deployments,services -n pod-info-xt2sz --kubeconfig=${CLUSTER_NAME}.conf
CODENAME READY UP-TO-DATE AVAILABLE AGE deployment.apps/podinfo 2/2 2 2 118m NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE service/podinfo ClusterIP 10.99.239.120 <none> 9898/TCP,9999/TCP 118m
Port forward the podinfo service (port 9898) to verify (on the attached or managed cluster):
CODEkubectl port-forward svc/podinfo -n pod-info-xt2sz 9898:9898 --kubeconfig=${CLUSTER_NAME}.conf
CODEForwarding from 127.0.0.1:9898 -> 9898 Forwarding from [::1]:9898 -> 9898 Handling connection for 9898 Handling connection for 9898 Handling connection for 9898
Open a browser and type in localhost:9898. A successful deployment of the podinfo app gives you this page: