Skip to content

Instantly share code, notes, and snippets.

@ThePredators

ThePredators/readme.md

Last active May 5, 2021
Embed
What would you like to do?

🔥 Docker-Kubernetes-Helm (Cheat Sheet)

Cheat Sheet

Docker

Kubectl

Helm

Install Docker

brew install docker

Install Kitematic

brew install --cask kitematic

Install Kubectl

brew install kubectl

Install Helm

brew install helm

Usefull CLI

## Docker
alias dk="docker"
alias di="docker images"
alias dirm="docker rmi -f "
alias db="docker build . -t "
alias dcb="docker-compose up -d --Build"
alias dcbf="docker-compose up -f build"
alias dps="docker ps" 
alias dcc="docker clean cache" 
alias dl="docker logs "

dc() {
  docker $@;
}

dcp() {
  HTTP_PROXY=$PROXY docker $@;
}

dr() {
  docker run -i -t -p $1:$2 $3; 
}

drp() {
  HTTP_PROXY=$PROXY docker run -i -t -p $1:$2 $3; # from:to
}

ds() {
  docker exec -it $@ bash;
}

dsp() {
  HTTP_PROXY=$PROXY docker docker exec -it $@ bash;
}

## Kubectl
alias kl="kubectl logs -f"
alias kp="kubectl get pod -w"

# kubectl port forward
kpf() { 
  kubectl port-forward pods/$1 $3:$4 -n $2; 
}

# kubectl port forward behind proxy
kpfp() {
  https_proxy=$PROXY http_proxy=$PROXY kpf $@;
}

kcs() {
  kubectl create secret generic $1 --from-file=$2; # TOTO.json
}

kcsp() {
  https_proxy=$PROXY http_proxy=$PROXY kubectl create secret generic $1 --from-file=$2;
}

kcsd() {
  kubectl delete secret $1;
}

kcsdp() {
  https_proxy=$PROXY http_proxy=$PROXY kcs;
}

## Helm
HELM_HOME=/Users/$(whoami)/HELM_INSTALL_DIR
export PATH=$HELM_HOME:$PATH
alias helmi="helm init --client-only"
alias helmlist="helm list --tiller-namespace $@"
alias helmgs="helm get service"
alias helmc="helm create "

helmp() {
	helm del $(helm ls --all --short) --purge;
}

helmtus() {
    helm status $1 --tiller-namespace $2;
}

helmdel() {
    helm del --purge $1 --tiller-namespace $2;
}

helmdelc() {
    helm delete epose --tiller-namespace context_name --purge;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment