Local Development Pipeline Using Skaffold on Kubernetes

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

--

--

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