Skip to content

Instantly share code, notes, and snippets.

@vfarcic
Last active November 11, 2023 16:01
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
  • Save vfarcic/0466cff59d08cabb5276f593ca2e513d to your computer and use it in GitHub Desktop.
Save vfarcic/0466cff59d08cabb5276f593ca2e513d to your computer and use it in GitHub Desktop.
# Source: https://gist.github.com/0466cff59d08cabb5276f593ca2e513d
#########################################
# Skaffold #
# How to Build and Deploy In Kubernetes #
# https://youtu.be/qS_4Qf8owc0 #
#########################################
#########
# Setup #
#########
# Install `skaffold` CLI from https://skaffold.dev/docs/install/
minikube start
minikube addons enable ingress
# Change the value to whatever is your Ingress host if not using minikube
export INGRESS_HOST=$(minikube ip).nip.io
git clone https://github.com/vfarcic/skaffold-demo.git
cd skaffold-demo
# This is just in case I forgot to remove it from the repo.
rm -rf skaffold.yaml
cat orig/ingress.yaml \
| sed -e "s@acme.com@dev.devops-toolkit.$INGRESS_HOST@g" \
| tee k8s/ingress.yaml
cat kustomize/base/ingress-patch.yaml \
| sed -e "s@acme.com@devops-toolkit.$INGRESS_HOST@g" \
| tee kustomize/overlays/production/ingress-patch.yaml
##############
# Initialize #
##############
cat Dockerfile
skaffold init --help
skaffold init
cat skaffold.yaml
###########
# Develop #
###########
cp skaffold-simple.yaml skaffold.yaml
skaffold dev
# Switch to a new terminal session
kubectl get all
kubectl get ingress
# Open the app in a browser
# Feel free to use any other editor
vim config.toml
# Go back to the terminal session where `skaffold` is running
# Cancel with *ctrl+c*
kubectl get all,ingress
###################
# Supported tools #
###################
# Open https://skaffold.dev/docs/references/yaml
##################
# Build & deploy #
##################
cp skaffold-better.yaml skaffold.yaml
cat skaffold.yaml
skaffold run --profile prod
kubectl --namespace production \
get all,ingress
skaffold delete \
--profile prod
skaffold build
skaffold build --quiet
skaffold build --quiet \
| skaffold deploy \
--build-artifacts -
skaffold delete
skaffold render
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment