Local Development Pipeline Using Skaffold on Kubernetes

List of tools:

  • Skaffold: Pipeline automation software
  • K3s: Lightweight Kubernetes software
  • K3d: Deployed Kubernetes cluster on top of Docker Desktop
  • Docker Desktop: Host development and testing environment on top of MacOs

Installation

brew install k3d
brew install skaffold

Create a Local Container Registry using K3d

# k3d prefix will be added with name "registry" 
k3d registry create registry
% docker ps | grep k3d-registry
3318342041e4 registry:2 3 hours ago Up 3 hours 0.0.0.0:54838->5000/tcp k3d-registry %

Create a Kubernetes Cluster using K3d

k3d cluster create --registry-use k3d-registry:5000

Deploy Application Pipeline using Skaffold

git clone --depth 1 https://github.com/GoogleContainerTools/skaffold cd skaffold/examples/getting-started# tree
.
├── Dockerfile
├── k8s-pod.yaml
├── main.go
├── README.md
└── skaffold.yaml
apiVersion: v1
kind: Pod
metadata:
name: getting-started
spec:
containers:
- name: getting-started
image: k3d-registry:5000/skaffold-example
apiVersion: skaffold/v2beta28
kind: Config
metadata:
name: getting-started
build:
artifacts:
- image: k3d-registry:5000/skaffold-example
docker:
dockerfile: Dockerfile
deploy:
kubectl:
manifests:
- k8s-pod.yaml
$ skaffold dev
$ skaffold dev 
....
....
Waiting for deployments to stabilize...
- pods: creating container getting-started
- pod/getting-started: creating container getting-started
- pods: container getting-started is waiting to start: localhost:54838/k3d-registry_5000_skaffold-example:8f4e453-dirty@sha256:fff5b4a514471d41cb038ac8e5ed00e9182b0bfc10f0b6e91afc8fbe7db4cd45 can
- pod/getting-started: container getting-started is waiting to start: localhost:54838/k3d-registry_5000_skaffold-example:8f4e453-dirty@sha256:fff5b4a514471d41cb038ac8e5ed00e9182b0bfc10f0b6e91afc8fbe7db4cd45 can' t be pulled
- pods failed. Error: container getting-started is waiting to start: localhost:54838/k3d-registry_5000_skaffold-example:8f4e453-dirty@sha256:fff5b4a514471d41cb038ac8e5ed00e9182b0bfc10f0b6e91afc8fbe7db4cd45 can Cleaning up...
- pod "getting-started" deleted 1/1 deployment(s) failed
...
$ skaffold config set default-repo k3d-registry:5000 
$ skaffold config list skaffold
config:
kube-context: k3d-k3s-default
default-repo: k3d-registry:5000
$ skaffold dev --default-repo=k3d-registry:5000

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

{UPDATE} Westelijke cowboy paardrijden simulator Hack Free Resources Generator

Codeworks Bootcamp: Weeks 5 & 6

Why development environment is so important?

SUPER-Quiz from Kestutis (CENTUS admin)!

Getting Started with TDD

Shutdown Is No Time For Spring Cleaning

Announcement for Brave World Maintenance on May 12th

READ/DOWNLOAD*$ MFC Internals: Inside the Microsof

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Arif Hossen

Arif Hossen

More from Medium

Open Application Model (OAM) — Bringing some sanity to application deployment on kubernetes (k8s).

Server Monitoring Guide: Using Prometheus, Grafana And Node_Exporter For Easy Server Monitoring

Service Function Chaining in Kubernetes using Squid Proxy for SASE Providers

WSL — Kubernetes Service with Session Affinity