k8s lab 02

Wed, Oct 27, 2021 One-minute read

So, got a few use cases that I want to try:

  • Configure aliases and handy stuff (autocomplete) for the terminal
  • Deploy a new container
  • more later …

Configure aliases and handy stuff (autocomplete) for the terminal

Add this lines to ~/.bash_profile:

alias k="minikube kubectl --"
set_minikube () {
  eval $(minikube -p minikube docker-env)
}
source <(k completion bash)
complete -F __start_kubectl k

I have a simple Makefile for builds and deploys:

kdeploy:
  minikube kubectl -- apply -f hello.yaml

kdelete:
  minikube kubectl -- delete -f hello.yaml

kservice:
  minikube kubectl -- expose deployment k8s-lab-deployment --type=LoadBalancer --port=5000

release: build
  docker tag k8s-lab k8s-lab:$(version)
  # something to 
  yq e -i '.spec.template.spec.containers[0].image = "k8s-lab:$(version)"' hello.yaml

deploy: release kdeploy

So i can deploy with:

make release version=X