Continuous Deployment Quick Start
8 minute read
You can install the Edge Delta Free Edition agent on a Kubernetes cluster using Continuous Deployment (CD) with GitOps principles. To do this, you configure your CD tooling such as Argo CD, Flux or Jenkins X to synchronize the cluster with the manifests on your configuration repository.
When you make updates to the configuration repository, they are automatically applied by your CD tooling to the cluster. It does this by polling the configuration regularly. If there is a mismatch between the configuration (desired state) and the cluster (current state), the configuration is pulled and applied to the cluster. This enables cluster self healing.
In addition, you save any dependent images in your own image repository. Keeping your images and configurations isolated gives you control over changes. With this workflow, change control on the configuration repository and image repository enables you to have change control on your cluster.
In addition, you can monitor changes to images and configurations using code diffs before applying them to your image repo, configuration repos, and in turn, cluster.
This also makes maintaining custom settings easier as you can isolate all your customizations from vendor updates to the default manifests.
Alternatively, for a lightweight implementation you can configure your CD tool to use the public Edge Delta chart repository and image store and simply pass in custom variables.
.png)
Required Information
To configure your CD tooling to deploy the Edge Delta agent, you need the following information:
- The Edge Delta helm chart location on your configuration repository.
- The Edge Delta agent image location on your image repository.
- The private API key for your agent. The agent API key is provided in the installation instructions when you first install an agent in the free Edition. If you don’t know the key you can view the installation instructions: click Admin - Clusters, click the drop down icon in the Actions column and select Deploy Instructions. The API key is the
secretApiKey.value=
value. - The currently supported version for the Free Edition agent ({{variable.Current Free Edition Version}}). The current version is also provided in the installation instructions. The version is the
image.tag=
value.
Example Implementation: Argo CD
The following example uses Argo CD. The Edge Delta agent image is saved on an owned image store, in this instance Docker Hub. The helm chart and Argo CD configuration files are saved on a private configuration repository, in this case on GitHub. Argo CD polls this configuration repo for the configuration and it deploys Edge Delta in a Kubernetes cluster that, in this instance, it also resides on. The initial configuration is done on a local computer while the Kubernetes cluster is on a separate host.
Prerequisites for the K8s Host
The K8s host can be the same as the local host. It requires a running Kubernetes cluster with the Argo CD CLI (external linkl) installed.
Install Prerequisites on the local host
- Install git. If you have homebrew:
brew install git
- Install Docker. If you have homebrew:
brew install --cask docker
- Install Helm. If you have homebrew:
brew install helm
Create a Configuration Repository
Using your local machine:
- Create a private repository in GitHub or another git repo host.
- Ensure you have access to your repository with write permissions, for example with an installed SSH key / Personal Access Token.
For the purposes of a POV, POC or to learn, you can refer to a private GitHub repo by creating a PAT and adding it to the URL you use to specify the repo. This is not a recommended method for production.
https://<pat>@github.com/<your username>/<repo>.git
Add the Edge Delta Chart to the Repository
On your local machine:
- Create a local clone of your configuration repo and navigate into it.
git clone git@github.com:<username/repo-name>
cd <repo-name>
- Download the edge delta helm chart.
helm repo add edgedelta https://edgedelta.github.io/charts
helm repo update
- Pull the chart with the required version, in this instance {{variable.Current Free Edition Version}}, into a charts/edgedelta folder
mkdir -p charts/edgedelta
cd charts/edgedelta
helm pull edgedelta/edgedelta --version v0.1.56
- Create a helm index file in the charts/edgedelta folder and configure it to point to the folder’s URL in your configuration repo. The URL parameter in the index indicates the location of the tgz file.
helm repo index ../edgedelta --url <your-repo>/charts/edgedelta
- Add, commit and push the changes to your configuration repo on the main branch.
git add .
git commit -m "<commit-message>"
git push origin main
Create an Image Store Containing the Edge Delta Images
On your local machine:
- Create an image store and ensure you have access to it, in this example a docker hub account is used.
- Unpack a copy of the chart you downloaded earlier and open it.
helm pull edgedelta/edgedelta --version v0.1.56 --untar
cd edgedelta
cat values.yaml
- Examine the values.yaml file and note the image repo location for the agent:
gcr.io/edgedelta/agent
image:
name: gcr.io/edgedelta/agent
You may want to also have optional Edge Delta images in your store like the trouble shooter and HttpRecorder:
- gcr.io/edgedelta/agent-troubleshooter:latest
- gcr.io/edgedelta/httprecorder:latest
- Pull the specific Edge Delta agent image and version from the public image store.
docker pull gcr.io/edgedelta/agent:v0.1.56
- Tag the local image with your image repo URL and the tag
docker tag gcr.io/edgedelta/agent:v0.1.56 <imagerepo.io/yourusername/yourreponame>:v0.1.52
- Push the local image to your store using the tag.
docker push <imagerepo.io/username/reponame>:v0.1.56
- Clean up the unpacked chart and local images.
docker image ls
docker image rm -f <image ID>
cd ..
rm -r edgedelta
Create the Argo CD Configuration File
There are a number of methods to create parameter overrides that contain your customizations. You may also want to isolate your development, test and production environments. While Kustomize is a recommended approach, this demonstration will add helm parameters for image.name to the Argo CD application definition. The secret API key will be passed in separately by Argo CD and saved on the cluster as a secret.
On your local machine:
- Navigate to the cloned configuration repository and create an argocd directory
cd ../..
mkdir argocd
- Create the app.yaml file in the argocd folder with the following commands. Specify the location of the helm index file in the repoURL parameter. Enter the required version in the targetRevision parameter. Finally, specify the location of the agent in your image repo with the value parameter.
cd argocd
echo 'apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: edgedelta
namespace: argocd
spec:
project: default
source:
chart: edgedelta
repoURL: <yourconfiguration repo>
targetRevision: <the required version, for example 0.1.56>
helm:
parameters:
- name: image.name
value: "<your image location>"
destination:
server: "https://kubernetes.default.svc"
namespace: edgedelta
syncPolicy:
automated:
prune: true
selfHeal: true
syncOptions:
- CreateNamespace=true' >app.yaml
The Argo CD application definition’s syncPolicy section will automatically update when changes are made to the source repo (automated), it will delete applications with configuration that are no longer in the source repo (prune), and it will reject manual changes to the cluster if they are not in conformance with the configuration repo. Finally, it will automatically create the namespaces required for the applications in the configuration based on the spec.destination.namespace.
- Push your changes to the repo.
git add .
git commit -m "<commit-message>"
git push origin main
Install Argo CD in the cluster
On the K8s host:
- Create the argocd namespace
kubectl create namespace argocd
- Deploy the Argo CD server in the Kubernetes cluster in the argocd namespace. Then wait for the pods to be ready.
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
kubectl get po -A
Following GitOps principles, consider copying the argocd install yaml file to your own repository and accessing it from there.
- To pass in the API key and repo credentials you need to log into the argocd server. First, expose the Argo CD server with an external IP in accordance with your organization’s ingress policy. For this demo, the server is port forwarded. Other methods are discussed here (external link).
kubectl port-forward svc/argocd-server -n argocd 8080:443
- In a new terminal, get the default password and copy it.
kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d; echo
- Login onto the admin user account using the default password and change the password:
argocd login localhost:8080
argocd account update-password
- Configure credentials, in accordance with your company security policy, to your configuration repository for Argo CD. In this example, a personal access token (PAT) generated by GitHub is provided as a password.
argocd repo add <your repo URL> --username <your username> --password <personal access token>
- Deploy the app.yaml configuration in the argocd namespace:
kubectl -n argocd apply -f <your configuration repo>/argocd/app.yaml
- Pass in the secret API key for the agent to connect to the Edge Delta Saas.
argocd app set edgedelta -p secretApiKey.value=<your-API-key>
Manage Upgrades
When a new agent release is required by Edge Delta for the Free Edition agent, you can upload the new version to your image repo and update the targetRevision version number in the app.yaml. If the Edge Delta pod fails you can roll back to the working configuration.
Similarly, you should regularly check for updates to the helm chart and run a diff to ensure that you know what changes occured.
After installing the agent, you can Set Up Alerts.