8000 GitHub - maliksalman/kpack-showcase: Contains Kubernetes resources and scripts that will showcase how Kpack can turn a Git repository into OCI image
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Contains Kubernetes resources and scripts that will showcase how Kpack can turn a Git repository into OCI image

Notifications You must be signed in to change notification settings

maliksalman/kpack-showcase

Repository files navigation

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 "user@kpack.demo" \
    -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

About

Contains Kubernetes resources and scripts that will showcase how Kpack can turn a Git repository into OCI image

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

0