Giter Site home page Giter Site logo

contato318 / k3d-local-registry Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tilt-dev/k3d-local-registry

0.0 1.0 0.0 14 KB

Easy set-up (via k3d) for k3s cluster with local registry for use with Tilt

License: Apache License 2.0

Shell 100.00%

k3d-local-registry's Introduction

k3d-local-registry

When using Tilt with a k3s cluster, we recommend using a local registry for faster image pushing and pulling.

This repo provides a script to help you set up your cluster (via k3d) with a local image registry that Tilt can auto-detect, so you don't need to do any additional configuration, and Tilt knows where to push/pull your images to/from.

How to Try It

  1. Install k3d (note: these instructions require k3d v1.x)

  2. Copy the k3d-with-registry.sh script somewhere on your path.

  3. Create a cluster with k3d-with-registry.sh. Currently it uses the default registry name registry.local and default port 5000.

k3d-with-registry.sh
  1. Verify your registry:
docker pull nginx:latest
docker tag nginx:latest localhost:5000/nginx:latest
docker push localhost:5000/nginx:latest

Set your KUBECONFIG as specified in script output (e.g. export KUBECONFIG="$(k3d get-kubeconfig --name='diffname')") and try spinning up a pod that references an image in your registry:

cat <<EOF | kubectl apply -f -
apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-test-registry
  labels:
    app: nginx-test-registry
spec:
  replicas: 1
  selector:
    matchLabels:
      app: nginx-test-registry
  template:
    metadata:
      labels:
        app: nginx-test-registry
    spec:
      containers:
      - name: nginx-test-registry
        image: registry.local:5000/nginx:latest
        ports:
        - containerPort: 80
EOF

Verify the pod spun up correct with: kubectl get pods -l "app=nginx-test-registry"

Congrats! You can now push images to localhost:5000/xxx, and reference them in your k8s YAML as registry.local:5000/xxx.

Tilt will automatically detect the local registry created by this script, and do the image tagging dance (as of Tilt v0.12.0). In your Tiltfle and in your K8s YAML, just refer to the image as my-image, and Tilt will take care of prepending localhost:5000 etc. as appropriate.

See also

License

Copyright 2020 Windmill Engineering

Licensed under the Apache License, Version 2.0

k3d-local-registry's People

Contributors

maiamcc avatar nicks avatar tsloughter avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.