You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a step-by-step guide to help you clone a private GitHub repository inside the Pod in Kubernetes Argo workflow.
Table of Content
Create a secret with .ssh keys using kubectl
Using secret inside YAML file to access secret.
Pre-requisite
minikube or Kubernetes and Argo workflow up and running (Refer the previous blog for installation).
Basic understanding of Kubernetes.
What is Secrets in Kubernetes:
Kubernetes Secrets let you store and manage sensitive information, such as passwords, OAuth tokens, and ssh keys. Storing confidential information in a Secret is safer and more flexible.
A Secret is an object that contains a small amount of sensitive data such as a password, a token, or a key. Such information might otherwise be put in a Pod specification or in an image.
To use a secret, a pod needs to reference the secret. A secret can be used with a Pod in three ways:
- As files in a volume mounted on one or more of its containers.
- As a container environment variable.
- By the kubelet when pulling images for the Pod.
Steps to create a Secret for .ssh keys.
We want to use the .ssh keys inside a Pod to clone a private repository and to share a .ssh keys, we need to create a secret using the below command.
_ Note: Replace below path with an original path for .ssh keys._**
This is a step-by-step guide to help you clone a private GitHub repository inside the Pod in Kubernetes Argo workflow.
Table of Content
kubectl
YAML
file to access secret.Pre-requisite
What is Secrets in Kubernetes:
Kubernetes Secrets let you store and manage sensitive information, such as passwords, OAuth tokens, and ssh keys. Storing confidential information in a Secret is safer and more flexible.
A Secret is an object that contains a small amount of sensitive data such as a password, a token, or a key. Such information might otherwise be put in a Pod specification or in an image.
To use a secret, a pod needs to reference the secret. A secret can be used with a Pod in three ways:
Steps to create a Secret for .ssh keys.
We want to use the .ssh keys inside a Pod to clone a private repository and to share a .ssh keys, we need to create a secret using the below command.
_ Note: Replace below path with an original path for .ssh keys._**
Once you create a
secret
using the above command, you will see the below message.To get a list of all defined secrets, you can below command.
Use secrets inside YAML:
Now you can create a Pod which references the secret with the ssh key and consumes it in a volume
**Note: I am using the
Argo Workflow
template.When the container's command runs, the pieces of the secret key will be available in:
The container is then free to use the secret data to establish an ssh connection.
Using above secret to clone private GitHub repository.
**Note: You can access your GitHub repository at
/opt/app
path.The text was updated successfully, but these errors were encountered: