Giter VIP home page Giter VIP logo

kpack-showcase's Introduction

kpack-showcase

This repository contains Kubernetes resources and scripts that will showcase how Kpack can be used to follow changes in a Git repository to convert code into OCI complaint images and push/tag them to the Docker registry. These images can then be used to deploy your apps in Kubernetes.

Pre-requisites

  1. Install kubectl and/or k9s.
brew install kubernetes-cli k9s
  1. Install minikube and make sure it is running.
berw install minikube
minikube start --memory='4096m' --cpus=4
  1. Generate a new SSH key-pair using the command bellow. The files (id_ed25519 and id_ed25519.pub) will be placed in the creds directory. The contents of creds/id_ed25519.pub need to be registered with your Git provider (like GitHub) as the SSH key.
ssh-keygen -t ed25519 \
    -C "[email protected]" \
    -f creds/id_ed25519 \
    -q -N ""
  1. You will need a private Git repository hosted by the above mentioned Git provider and accessible via above generated SSH key-pair. This needs to be a cloud-native buildpacks compatible code-base - like a spring-boot app. For example, https://github.com/maliksalman/spring-data-jpa-sample. If you want to use that code, fork the repository but keep the forked copy private so the SSH keys generated above can be utilized.

  2. You will need to have access to a Docker registry where OCI images will be uploaded. This example assumes Google Cloud Container Registry. The JSON key to access GCP services programmatically is needed. Once obtained, place the contents of that JSON key in creds/gcr-key.json

Steps

  1. Install latest version of kpack:
./10-install-kpack.sh
  1. Create kpack store and stack which are cluster level resources:
kubectl apply -f 20-kpack-cluster.yml
  1. Create the dev namespace where we will play:
kubectl apply -f 30-create-dev-space.yml
  1. Create various secret resources (pushing/pulling images, accessing git):
./40-create-secrets.sh
  1. Create a service-account that kpack will use to pull source code from Git and then push the built image to a docker registry
kubectl apply -f 50-service-account.yml
  1. Create a kpack builder that knows which buildpacks are in play. The builder is a namespaced resource:
kubectl apply -f 60-builder.yml
  1. Create a kpack image resource which points to our private Git repo. This is the resource which will create OCI images in our configured docker registry:
kubectl apply -f 70-image.yml
  1. Create a deployment which will use that image and deploy the app to our cluster
kubectl apply -f 80-deployment.yml

kpack-showcase's People

Contributors

maliksalman avatar

Stargazers

Ram Kolluri avatar

Watchers

James Cloos avatar  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.