Skip to content

Chunosov/learn-kuber

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

kubernetes lessons and samples

Sequence of samples

💀 - not working

minikube cluster

kind cluster

k3s cluster

Various examples

Advanced examples

Tools

kubectl

Install kubectl binary:

curl -LO "https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl"
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl

kubectl version
Client Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.1", GitCommit:"206bcadf021e76c27513500ca24182692aabd17e", GitTreeState:"clean", BuildDate:"2020-09-09T11:26:42Z", GoVersion:"go1.15", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.0", GitCommit:"e19964183377d0ec2052d1f1fa930c4d7575bd50", GitTreeState:"clean", BuildDate:"2020-08-26T14:23:04Z", GoVersion:"go1.15", Compiler:"gc", Platform:"linux/amd64"}

minikube

Install minikube binary for trying minikube examples:

curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
chmod +x minikube
sudo mv minikube /usr/local/bin

minikube version
minikube version: v1.13.0
commit: 0c5e9de4ca6f9c55147ae7f90af97eff5befef5f-dirty

kind

Install kind binary for trying kind examples.

#curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.8.1/kind-linux-amd64
curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.24.0/kind-linux-amd64
chmod +x kind
sudo mv kind /usr/local/bin

kind version
#kind v0.8.1 go1.14.2 linux/amd64
kind version 0.24.0

grpcurl

We use grpcurl for testing gRPC services.

curl -LO https://github.com/fullstorydev/grpcurl/releases/download/v1.7.0/grpcurl_1.7.0_linux_x86_64.tar.gz
tar -zxvf grpcurl_1.7.0_linux_x86_64.tar.gz -C .
chmod +x ./grpcurl
sudo mv grpcurl /usr/local/bin
rm grpcurl_1.7.0_linux_x86_64.tar.gz

grpcurl -version
grpcurl v1.7.0

istio

Installation steps for Istio are described here:

curl -L https://istio.io/downloadIstio | sh -
sudo mv istio-1.7.1/bin/istioctl /usr/local/bin

istioctl version
no running Istio pods in "istio-system"
1.7.1

helm

Installation steps for helm are described here:

curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
chmod 700 get_helm.sh
./get_helm.sh

kubernetes spells

■ Create a single pod from image:

kubectl run $POD --image=praqma/network-multitool

■ Get a shell to the running container:

kubectl exec --stdin --tty $POD -- /bin/bash

■ Get pod name by application name:

kubectl get pod -l app=$APP -o jsonpath='{.items[0].metadata.name}'

■ Get service node port:

kubectl get service $SERVICE --output='jsonpath="{.spec.ports[0].nodePort}"'

■ Get pod container port:

kubectl get pod $POD  --template='{{(index (index .spec.containers 0).ports 0).containerPort}}{{"\n"}}'

■ Show logs for a pod (-p show log for the previous crashed instance, it's very useful when pod gets stuck in the CrashLoopBackOff state):

kubectl logs $POD -p

■ Port forwarding:

kubectl port-forward $POD $LOCAL_PORT:$POD_PORT
kubectl port-forward pods/$POD $LOCAL_PORT:$POD_PORT
kubectl port-forward service/$SERVICE $LOCAL_PORT:$SERVICE_PORT

About

kubernetes lessons and samples

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published