Skip to content

rockybranches/rb-k8s-pullthrough-cache

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

rb-k8s-pullthrough-cache

Description

Ref: How to deploy... (Perplexity.ai thread)

Step-by-step guide to deploying a container image registry as a Kubernetes pull-through cache.

Guide

Prerequisites

  • A Kubernetes cluster
  • Helm
  • Docker
  • kubectl

Step 1: Deploy the Registry

registry.yaml: Create the registry deployment

apiVersion: apps/v1
kind: Deployment
metadata:
  name: docker-registry
spec:
  replicas: 1
  selector:
    matchLabels:
      app: docker-registry
  template:
    metadata:
      labels:
        app: docker-registry
    spec:
      containers:
      - name: registry
        image: registry:2
        ports:
        - containerPort: 5000
        volumeMounts:
        - name: registry-data
          mountPath: /var/lib/registry
      volumes:
      - name: registry-data
        emptyDir: {}

Deploy the registry

$ kubectl apply -f registry.yaml

Step 2: Configure the registry as a pull-through cache

config.yaml: Configure the registry

version: 0.1
storage:
  filesystem:
    rootdirectory: /var/lib/registry
http:
  addr: :5000
proxy:
  remoteurl: https://registry-1.docker.io  # Docker Hub

Step 3: Use the cache in deployments

deployment.yaml: Use the cache in deployments (example)

apiVersion: apps/v1
kind: Deployment
metadata:
  name: myapp-deployment
spec:
  replicas: 1
  selector:
    matchLabels:
      app: myapp
  template:
    metadata:
      labels:
        app: myapp
    spec:
      containers:
      - name: myapp
        image: <your-registry-url>:5000/<your-username>/myapp:latest  # Replace with your registry URL, username, and app name
        ports:
        - containerPort: 80

Deploy the deployment

$ kubectl apply -f deployment.yaml

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published