What is a Repository (Repo) in Kubernetes (K8s)?
repository
(repo) is a storage
location for various components such as Helm charts, container images,
operators, and manifests. These repositories help deploy, manage, and version
control Kubernetes applications.
Types of
Repositories for Kubernetes (K8s).
In
Kubernetes, repositories store different types of resources like Helm charts,
container images, manifests, and operator packages. Below are the main types of
repositories used in Kubernetes:
1.Helm Repositories.
Used to
store and distribute Helm charts for deploying applications in
Kubernetes.
Examples:
- Helm Hub (ArtifactHub.io) – Public Helm charts
- ChartMuseum – Self-hosted Helm repo
- Harbor, Nexus, Artifactory – Private Helm chart storage
- Simple HTTP-based Repo – Local Helm repo using an HTTP
server
# helm repo
list
2.Container Image Repositories (OCI).
Used to
store and manage Docker/OCI container images for Kubernetes deployments.
Examples:
- Docker Hub – Public registry
- Harbor, Nexus, Artifactory – Private registries
- Amazon ECR, Google GCR, Azure
ACR –
Cloud-based container registries
- Quay.io – Red Hat’s container registry
image: myrepo/myimage:latest
3.Kubernetes Manifest Repositories (GitOps).
Used to
store YAML manifests for deployments, services, and CRDs in a Git
repository for GitOps workflows.
Examples:
- GitHub, GitLab, Bitbucket – Storing Kubernetes manifests.
- ArgoCD & FluxCD – GitOps tools for automatic
deployment.
- Kustomize Repos – Managing Kubernetes YAML
customizations.
# git clone https://github.com/user/k8s-manifests.git
4.OperatorHub Repositories.
Used to
store and distribute Kubernetes Operators, which automate application
deployment and management.
Examples:
- OperatorHub.io – Public operator repository
- OLM (Operator Lifecycle Manager) – Manages operators in
Kubernetes
- Red Hat Marketplace – Certified operators for
OpenShift
# kubectl
apply -f my-operator.yaml
5.Custom CRD Repositories (Custom
Controllers) .
Used to
store Custom Resource Definitions (CRDs) and custom controllers for
extending Kubernetes functionality.
Examples:
- GitHub Repos – Store CRD YAML files.
- Helm Charts – Package CRDs as Helm charts.
- Kubebuilder/Operator SDK – Develop and manage custom
controllers.
# kubectl apply -f my-crd.yaml
Summary
of Repository Types in Kubernetes.
Repository Type |
Purpose |
Examples |
Helm
Repositories |
packaging
and deploying applications |
Helm Hub,
ChartMuseum, Harbor, Artifactory |
Container
Image Repositories (OCI) |
Store
& distribute container images |
Docker
Hub, ECR, GCR, Harbor |
Kubernetes
Manifest Repositories (GitOps) |
Store raw
Kubernetes YAML manifests |
GitHub,
GitLab, ArgoCD, FluxCD |
OperatorHub
Repositories |
Store
Kubernetes Operators |
OperatorHub.io,
Red Hat Marketplace |
CRD
Repositories |
Store
Custom Resources & Controllers |
GitHub, Kubebuilder,
Operator SDK |
CLI tool for interacting with containerd.
# ctr image
pull docker.io/library/nginx:latest
# ctr images
list
Or
# ctr -n
k8s.io images list
# ctr
namespaces list
# ctr images
push myregistry.com/myimage:latest
# ctr
containers list
# ctr
-n k8s.io c ls
Pull Image from Private Registry
(Authentication Required).
# kubectl
create secret docker-registry my-registry-secret \
--docker-server=myrepo.com \
--docker-username=shashikant11 \
--docker-password=xxxxxxx \
--docker-email=shashi.brain11@gmail.com
# kubectl
get secrets
# vim tomcat-deployment.yaml
apiVersion:
apps/v1
kind:
Deployment
metadata:
name: tomcat-deployment
spec:
replicas: 1
selector:
matchLabels:
app: tomcat
template:
metadata:
labels:
app: tomcat
spec:
containers:
- name: tomcat
image: shashikant11/tomcat8:latest
imagePullPolicy: Always
imagePullSecrets:
- name: my-registry-secret # Reference the secret here
# kubectl
apply -f tomcat-deployment.yaml
# kubectl
describe pods tomcat-deployment-7b7c8548f6-h8j59
Pull image from JFrog Artifactory.
# kubectl
create secret docker-registry artifactory-secret \
--docker-server=artifactory.example.com \
--docker-username=admin \
--docker-password=password
Deploy a
pod:
image:
artifactory.example.com/docker-local/myimage:latest
imagePullSecrets:
- name: artifactory-secret
No comments:
Post a Comment