Skip to main content

5 posts tagged with "continuous-delivery"

View All Tags

· 11 min read

INTRODUCTION

This guide helps you to deal with common issues and recommended solutions right from the pipeline creation to its execution. You will find them categorized into different sections. We will bring in more troubleshooting tips in our upcoming guide series.

SERVICE

Issue:

Can we use the same service name for dev, QA, and prod so that when I choose the same service, it will automatically take the same infra and execution mode, or do we need to mention all those in the cd deploy stage?

Solution:

We can use the same service to deploy in all environments, provided your infrastructure is templated/ parametrized and saved as input sets. While deploying the service, you can provide it as runtime input.

CONNECTORS

Issue:

When a user is unable to create a git connector, not sure what URL to pick don’t know where to pick(not sure what URL has to be added under 'GitHub Repository URL'). github-connector

Solution:

Pattern URL looks like this: https://github.com/<account>/<repo>

Issue:

What happens if a user selects a Kubernetes cluster that has an INACTIVE delegate? k8-cluster-connector

Solution:

delegate-setup As per the screenshot above, make sure you verify the delegate if it is CONNECTED and you select the one that is active with ‘heartbeat’.

Issue:

remote-branch

Solution:

Check the git connector. Make sure the branch mentioned is available on the remote system.

Issue:

Hi, I provisioned a Helm Connector as the Connector Artifact Server. I would like to get the details of the connector via Harness SDK. I am aware of the GitHub repo, however, I cannot find the exact function I need to use, etc. Kindly help.

Solution:

If you want to get Harness configurations or automate the creation of resources you can use the REST APIs.

Issue:

Example for a connector in Harness SDK

Solution:

Currently, the SDK doesn't have native support for connector resources but it can still be fetched using the config-as-code APIs. If you know the path to the connector you can do something like this. If you already have a connector created you can find the path by going to Setup -> Config As Code (located in the top right-hand corner). From here you'll be able to see the path to where the connector's YAML configuration. For example, the path would be something like: Setup/Artifact Servers/Harness Docker Hub.yaml. I have attached a screenshot of it to look at.

Using the method I linked to, you'll be able to get back this YAML. There's not yet a native object in the SDK that you can easily parse this into, but you can create one yourself and deserialize it. Let me know if that helps in any way. (Screenshot attached for reference) Harness-sdk

MANIFEST FILES

Issue:

What happens if a user is trying to make a deployment using helm chart inputs wrong chart version? manifest-error

Solution:

Check the chart version while adding them to the manifest step in the pipeline stage. manifest-solution

ARTIFACTS

Issue:

When I try to run the pipeline, if I select the “tags” dropdown to add a tag to the execution, I get the following error: Stage Deploy_Dev: Please make sure that your delegates are connected. Refer [docs](https://ngdocs.harness.io/article/re8kk0ex4k) for more information on delegate Installation.

Solution:

If you are using docker to pick your artifacts, then make sure you are defining the right path. Right URL: https://registry.hub.docker.com/. You can define tags by providing inputs at runtime or define them in your YAML file ex: tag: “latest”.

ENVIRONMENT

Issue:

Multiple options are available for the user to set the SERVICE

  1. If the user wants to set a fixed value:

Solution:

edit-service

  1. If the user wants to pass it at runtime:

Solution:

pass-runtime

DEPLOYMENT STRATEGY

Issue:

What if the user selects a step irrelevant to the deployment strategy? deployment-strategy

Solution:

Make sure you select this step based on the deployment strategy selected. Say if you select a canary deployment, you have a canary delete step to delete the workloads and for other deployments, we have a delete step for cleaning.

Possible errors at the time of deployment

Issue:

What happens if the user inputs an invalid timeout for a step in a pipeline stage?

Solution:

Follow the tooltip tooltip

Issue:

When you enable editing mode and then try to navigate from YAML edit-mode

Solution:

Make sure you complete all the steps in the stage. Incomplete Yaml will not be allowed to navigate or move further.

DELEGATE

Issue:

Does the Harness delegate running in Kubernetes support node architecture using ARM64?

Solution:

  1. We are not providing the binaries for the client tools in arm64, you would need to build your custom docker image to already have the arm64 binaries in client tools, under the same path we expect. Then we would see they are already there and not overwrite them.
  2. To use arm64 would need to reverse engineer our docker image: create your own docker image that installs an arm64 JRE to run the Harness delegate jar and then pre-populate the client-tools directory with arm64 versions of the expected binary.s The following binary list can be used:
kubectl/v1.13.2/kubectl
go-template/v0.4/go-template
harness-pywinrm/v0.4-dev/harness-pywinrm
helm/v2.13.1/helm
helm/v3.1.2/helm
helm/v3.8.0/helm
chartmuseum/v0.12.0/chartmuseum
chartmuseum/v0.8.2/chartmuseum
tf-config-inspect/v1.0/terraform-config-inspect
tf-config-inspect/v1.1/terraform-config-inspect
oc/v4.2.16/oc
kustomize/v3.5.4/kustomize
kustomize/v4.0.0/kustomizen
scm/36d92fd8/scm

Note: We will be launching arm64 in couple of weeks

Issue:

The user wants to provision target infrastructure using terraform on Azure and deploy a sample app in it. The build pipeline executes but the deploy stage fails. delegate-capability-issue

Solution:

  1. Check if the delegate is ACTIVE and has enough resources assigned to the pod. You can check the pods state with the commands like:
kubectl get pods -n <<namespace>>
kubectl describe pods -n <<namespace>>
  1. For delegate capability issues, it depends on the specific user’s use case. Ex: if you want to do a terraform deployment, a few versions of terraform demand, terraform to be installed on the delegate pod. If you want to do a helm deployment using Helm V2, you will need to install Helm v2 and Tiller on the delegate pod.

  2. Please review our docs on supported integrations.

TEMPLATE

Issue:

Is there a way to do the equivalent of the helm template command to render the templates and display the output in the Harness?

Solution:

We run a Helm Template when we do a Helm Chart Manifest type with a Kubernetes Deployment Type, we don’t output that to a variable for a user to view, it can only be viewed in our execution logs. We don’t do this either for a Native Helm Deployment where we run a Helm Template and then perform the Helm install or helm upgrade and the output is only visible in the execution log.

helm-chart

We have seen our users fetch the chart in a shell script step and run the helm commands on the chart to see the output before Harness does a deployment.

Issue:

I am using Harness to spin a short-lived Kubernetes job. Is there any way to fetch the logs back to the Harness?

Solution:

You can write a shell script to fetch logs for you as an output and then you can export/download them as deployment logs.

Issue:

I was referring to this guide in Harness docs to learn about continuous delivery. On running the pipeline this error showed up. Does anyone know why this came and how to resolve it? API-calls

Solution:

Harness uses its own ConfigMap for every deployment to store the release history in a Kubernetes cluster. This ConfigMap can be used for Rollback if the deployment fails. Let’s say you are at your very first deployment(ConfigMap is yet to be created by Harness), now you want to make an API call to check if ConfigMap exists and say you get this error.

Invalid request: Failed to get ConfigMap. Code: 403, message:{"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"configmaps \"release-abcdef\" is forbidden: User \"system:serviceaccount:sa:harness\" cannot get resource \"configmaps\" in API group \"\" in the namespace \"ns\"","reason":"Forbidden","details":{"name":"release-abcdef","kind":"configmaps"},"code":403} 

It is clear from the above screenshot that API calls are failing due to permission. Check the permissions and try again and this doc should help.

Issue:

Hi, I am creating a custom service command in Harness that simply deploys a zip file to my host. I realized that if for some reason my artifact does not get deployed correctly and the zip file does not exist on my host, an error will NOT get thrown when the unzip command fails. I tried forcing Harness to throw an error by writing to stderr using.

if [-f "$ARTIFACT_FILE_NAME" ]; then
unzip "$ARTIFACT_FILE_NAME"
else
1>&2 echo "Error: cannot find artifact"

But Harness still treats this as an INFO message in the logs and does not fail the deployment. Any suggestions for how to fail a deployment through my bash script?

Solution: You can refer to this doc, make sure you set -e works as syntactically the '[-f' part of the script is going to cause a failure.

Issue: How to pull zip files from artifacts in the cd stage?

Solution: We don’t support that yet in Next Generation. We only support containerized Kubernetes deployments and native helm deployments in the platform. Please review our docs on supported integrations: Please review our docs on supported integrations.

SECRETS

SSH KEY

Issue:

Error while configuring the Linux server with ssh in Harness. ssh-server

Solution:

  1. The connection issue likely has something to do with the URL. For an AWS Linux box, it’s usually something like ec2-76-939-110-125.us-west-1.compute.amazonaws.com. For Azure, normally it would be something like ssh -i ~/.ssh/id_rsa azureuser@10.111.12.123 so in Harness try it without the https:// scheme.:
  2. The SSH key in your screenshot looks like it’s in NextGen. You can also use a Shell Script step in NextGen.
  3. In Harness CurrentGen you can deploy to any Linux VM using our SSH Deployment Type, you can also use Azure VMSS.
  4. You can deploy to a physical server.
  5. If you’re just looking to copy files as part of a 'workflow', you can use a Shell Script step.
  6. For artifact copy, as opposed to deployment, you can use the SSH Service and Copy Artifact Command.

COMMON ISSUES

Issue:

Hi, need some help with the following questions:

  1. In Harness cd while deploying helm chart [from an HTTP helm chart], can I upload custom values.yaml file which is at a different location?
  2. Installed a helm chart on an aks cluster using a Harness but tried to run the helm list locally in my terminal unable to see the release name in the cmd output?
  3. In Harness CD, can I give a custom release name while installing the helm chart in the pipeline?

Solution:

To answer your question:

  1. You can do that, refer to the section values.yaml
  2. By default the app is installed under the Harness namespace so you need to add -n harness to the Helm command. Try:
helm list -n harness
  1. Yes, we can do that custom-release-name

Issue:

Can Harness CD deploy a helm chart and support kustomize patch on top of the helm chart? Are helm charts deployed by Harness visible using the helm CLI on the targets?

Solution:

  1. We can fetch Helm charts for Kustomize Deployments. We can also apply Patches to those kustomize deployments. Harness Agent has its own Helm Client, we use that Helm client to query the deployed resources associated with the chart. With Kustomize and Helm charts, Harness wouldn’t deploy using Helm, we would deploy using the kustomize cli and we can apply patches. We would track the resources with the labels we apply to the Kubernetes objects we deploy.
  2. You could run a helm list -To list all the helm charts, that’s no problem. However, Harness will manage the state and take care of rollback for you vs the helm client and tiller. We already know what the previous resources are so in event of deployment failure we can roll back to the last known healthy state. We have an Argo CD Integration where we allow you to leverage your existing ArgoCD cluster and manage it with Harness and Integrate it natively with Harness CI.

Harness can use ArgoCD for GitOps

Harness can manage and orchestrate the Deployments out of the box without having ArgoCD cluster management. We manage the deployed resources on the cluster, we have a slew of integrations with Kubernetes, Helm, Kustomize, and Openshift, We give you Canary, Blue-Green, and Rolling Deployment Logic out of the box. We integrate with ArgoCD if you want that style of deployment with GitOps. Quick reference doc:

  1. Harness Argocd GitOps quickstart
  2. Use kustomize for Kubernetes deployments

Need further help?

Feel free to ask questions at community.harness.io or join community slack to chat with our engineers in product-specific channels like:

#continuous-integration Get support regarding the CI Module of Harness.

#continuous-delivery Get support regarding the CD Module of Harness.

· 3 min read
Debabrata Panigrahi

This tutorial aims at enabling users to set up a Kubernetes cluster on AWS and will serve as the foundation for your CI/CD pipeline infrastructure. After the infrastructure is ready on a free account, you can proceed to create and install a Delegate.

Credits for AWS

To avail free credits in AWS please follow the following resources:

If you are a student please sign in using AWS Educate

Note: Under the AWS Free tier the EKS service is not available, so it’s suggested to get some free credits and use them for EKS.

Pre-requisites:

There are certain requirements in terms of access and permissions and memory resources for the delegate to function properly.

Creating a Cluster:

Considering you are a first-time user, please consider the following specifications along with the above prerequisites, while creating a cluster:

  • Number of nodes: minimum of 3.
  • Machine type: 4vCPU
  • Memory: 12GB RAM and 6GB Disk Space. 8GB RAM is for the Delegate. The remaining memory is for Kubernetes and containers.
  • Networking: Outbound HTTPS for the Harness connection, and to connect to any container image repo. Allow TCP port 22 for SSH.

For creating a cluster follow the steps mentioned in the documentation, also you can take the help of the demo in the video below.

You will be able to see your cluster, after creation on the management console, like the picture below.

AWS Dashboard

Authenticate to the cluster:

  1. Open a terminal and navigate to where the Delegate file is located.
  2. You will connect to your cluster using the terminal so you can simply run the YAML file on the cluster.

AWS Access

  1. In the same terminal, log into your Kubernetes cluster. In most platforms, you select the cluster, click Connect, and copy the access command.

AWS Configure

  1. Next, install the Harness Delegate using the harness-delegate.yaml file you just downloaded. In the terminal connected to your cluster, run this command:

    kubectl apply -f harness-delegate.yml
  2. The successful output would look like this

delegate-install

  1. To validate run the following command and check.

    # kubectl get namespaces
    NAME STATUS AGE
    default Active 29h
    harness-delegate-ng Active 24m
    kube-node-lease Active 29h
    kube-public Active 29h
    kube-system Active 29h

Also, you could check for pods under your AWS cluster to find the delegate

delegate pods

  1. Now that your cluster is operational, you may add resources to it by using the kubectl utility, as you can see. Please use Start Deploying in 5 Minutes with a Delegate-first Approach tutorial to install Delegate at this time and move forward with creating your CI/CD pipeline.

Warning: You have to exit the present pipeline without saving to view delegate details/continue with further steps.

  1. You could check about your delegates on the dashboard under Project Setup.

check-delegate

  1. The delegate details would look something similar to this

delegate-available

Note: Apart from the above mentioned way, there are other ways to install delegate on AWS, for eg using EC2.

Need further help?

Feel free to ask questions at community.harness.io or join community slack to chat with our engineers in product-specific channels like:

#continuous-delivery Get support regarding the CD Module of Harness. #continuous-integration Get support regarding the CI Module of Harness.

· 4 min read
Hrittik Roy

Creating a delegate requires the creation of an infrastructure in which computational tasks can take place. The infrastructure is typically a Kubernetes cluster.

This tutorial shows you how to set up a Kubernetes cluster on Azure and will serve as the foundation for your CI/CD pipeline infrastructure. After the infrastructure is ready on a free account, you can proceed to create and install a Delegate.

Student Account

If you’re a student, you’re in luck as there is Azure for Students where you can sign in with your educational email address to create an account without a credit card to get $100 worth of credits.

These credits can be used to deploy the Kubernetes Cluster and other services if required.

To, get started with the account creation go to Azure for Students.

Step 1: Click on Activate Now

Activate Free Account

Step 2: After signing in with a Microsoft account, enter your educational email address:

Activate Azure for Students

Step 3: Sign in to Azure Portal!

A free Azure Account

For anyone who can verify their identity with a phone number and a credit card, Azure offers a free account with $200 in Azure credit. Once your account has been verified, you can create a Kubernetes cluster in it.

Step 1: Go to the Azure Free Account Page

Step 2: Click on Start free to start the account creation procedure

Azure Free Account

Step 3: Fill in the following fields

Fill Details

Step 4: Once your details are in click on Sign Up after you have accepted the terms and conditions.

Sign Up Credit Card

Step 5: Verify your phone number

Step 6: Put in your CC details and depending upon your Region a small amount will be deducted and refunded for verification.

Step 7: You can access your account using the Azure Portal

Azure Portal

Azure portal is the web-based management console for Microsoft Azure. It provides a single, unified view of all your Azure resources, including compute, storage, networking, and security. You can use the Azure portal to deploy and manage your Azure resources and to monitor their health and usage.

Azure Portal

You will use the portal to create your Kubernetes Cluster and connect to it.

Create a Cluster

The steps to create a cluster will be to use the Azure Kubernetes Service which is the managed Kubernetes offering from Azure. The steps are as follows:

Step 1: Click on Create a Resource after signing in

Create a Resource

Step 2: Search Container and then click on Kubernetes Service

Find Kubernetes Service

Step 3: Click on Create

Create Kubernetes Service

Step 4: On the Basics page, configure the following options for a Delegate to Run:

  • Project details:
    • Select an Azure Subscription.
    • Select or create an Azure Resource group, such as DelegateGroup.
  • Cluster details:
    • Enter a Kubernetes cluster name, such as myEnviroment.
    • Select a Region for the AKS cluster
    • Select 99.5% for API server availability for lower cost
  • Go to Scale Method and change it to Manual as your account might not have sufficient compute quota for autoscaling. Next change the Node Count to 2 image

Step 5: Start the resource validation by clicking Review + Create on your portal. Once validated, click Create to begin the process of cluster creation. Wait a few minutes for the cluster to deploy.

Connect to your cluster

Now, when your cluster is ready you can connect to the Azure Cloud Shel on your portal and open the terminal

Cloud Shell

Navigate to your cluster and click on Connect!

Connect to Cluster

Follow the steps displayed on the right panel and then you can connect to your cluster!

Run kubectl cluster-info to display details on your cluster!

Next Steps

Now that your cluster is operational, you may add resources to it by using the kubectl utility, as you can see. Please use Start Deploying in 5 Minutes with a Delegate-first Approach tutorial to install Delegate at this time and move forward with creating your CI/CD pipeline.

Need further help?

Feel free to ask questions at community.harness.io or join community slack to chat with our engineers in product-specific channels like:

· 3 min read
Debabrata Panigrahi

Are you confused with terminologies like Access Token, Access Control, and Personal Access Token while creating connectors? In this article, we will discuss a few such terminologies on the Harness platform, what they mean and what values should be entered against them.

So, in Harness when you are using CI/CD to build or deploy we need access to your source code repository and the enterprise cloud for deployments, and hence encrypted secrets are asked as input. In this blog, I have focused on the common errors faced by beginners while trying to setup GitHub connectors.

To begin with:

  1. Select new connector and from the new connector tab select Github under Code Repositories

    Connector Location

  2. Now it’s time to give a name to your connector, but there’s some entity name convention which you need to follow while naming it. Some common errors observed here are : For ease of understanding across orgs and easy identification, you can also add tags and give an apt description to your connector.

    ![Overview](./overview.png)
  3. It’s time for one of the most confusing steps of the process, giving the exact address for your connector which comes in two levels

    1. Account
    2. Repository

    What’s most intriguing and that first time user’s like me, made a mistake in selecting the connection type, so the suggested method is HTTP for first timers for ease of use and you can fetch this URL for your repository directly from the search bar of your browser or from local clone information available in the repository, which has the following format https://github.com/<account-name> for account URL’s type and https://github.com/<account-name>/<repository-name> for Repository URLs.

    Details

  4. Now, it’s time to add credentials, which are required for the authentication to GitHub repository.

    Credentials

    The value in the username field is the same as your GitHub username, and now the most crucial step of adding credentials, is adding the Personal Access Token as a secret, for that, you need to generate the PAT for your account by allowing adequate repo source control permission, which could be done by following the steps here. Further if you already have a PAT as a secret you could just skip to selecting the same, or else you need to add the generated PAT by selecting the “+New Secrets” and mentioning the PAT under the “Secret Value” field.

    Secrets

    Be careful not to add your GitHub password under the secrets for GitHub, as some users tend to do this and the connector fails to connect.

  5. Now while connecting to the provider it’s suggested to go for the connect through delegate step as it would allow delegates to perform tasks for you based on your requirements.

    Delegate-Setup

  6. Going further to the Delegate Setup step, I would suggest using any available delegate as a beginner, or if you want to use a particular delegate, select the same and click on the empty field under the same to select and add the delegates.

  7. What’s important to consider here is if you’re an absolute beginner using Harness for the first time, or have never created a delegate, please consider creating a delegate first by selecting the “Install new delegate” and following the resources mentioned here, to move forward and add a connector.

Need further help? Feel free to ask questions at community.harness.io or join community slack to chat with our engineers in product-specific channels like:

  1. #continuous-delivery Get support regarding the CD Module of Harness.
  2. #continuous-integration Get support regarding the CI Module of Harness.

· 3 min read
Krishika Singh

Before we begin :

Let us understand what do we mean by delegates and why is it needed

A Harness delegate is a software that you install in your deployment target environment such as local network ,VPC,or cluster and run as a service.The delegate performs all operations including deployment and integration. The delegate connects all your artifacts,infrastructure,collaboration,verification and other providers with the Harness Manager.

Below we have discussed the detailed explanation of how we can install Kubernetes(K8s) delegate.

Prerequisites

  • Hypervisor technology (VirtualBox, VMWare, etc) is a mandate pre-requisite for Minikube and we have to choose the right one based on the platform we are on.

    Prequisites for minikube

  • Installation section in the Minikube Getting Started documentation is well crafted and has steps for all Linux, Mac & Windows along with the architecture and installer type details and the user just has to choose the required details, get the commands and run them!

    Installing Minikube.

  • Minikube will download the required kubectl as part of the installation and configures it.

Installing Harness Delegate

  • Go to Harness

  • Go to Builds and under Project setup click delegates and then click on new delegates delegate

  • Click on kubernetes

    kubernetes

  • Name your delegate and select the size of delegate and also select delegate permissions. Please follow the correct naming convention for naming a delegate.

    • It will show error when you insert any special characters except ‘-’ and make sure name should not start or end with a number delegate

NOTE:These sizing requirements are for the Delegate only.Your cluster will require more memory for Kubernetes, the operating system, and other services,preferably one should have double the memory and node present in the cluster than that of required for the delegate for smooth functioning.

  • Download the yaml file yaml

  • After clicking on continue open the new terminal and open the directory where you have downloaded the yaml file and then run the following command:

    kubectl apply -f harness-delegate.yml

    download

  • It may take few minutes for verification,after successful installation of delegate following message will be displayed:

download2

  • You can go to the delegate section in the project setup and see the delegate you have installed:

delegate option

  • You can also delete your delegate when no longer in use

Note: Our Kubernetes Delegates are immutable , that is you can only create and delete the delegate but you can’t make any changes to them.