Skip to content

k8s

command

Config

# help
kubectl config 

#${HOME}/.kube/config
#kubectl config --kubeconfig="C:\someotherfolder\config"
#$KUBECONFIG

contexts

#get the current context
kubectl config current-context

#get and set contexts
kubectl config get-contexts
kubectl config use-context minikube

get command

kubectl get <resource>

#examples
kubectl get pods
kubectl get deployments
kubectl get services
kubectl get configmaps
kubectl get secrets
kubectl get ingress

other

## port-forward
kubectl port-forward mysql-dp-8dfb795cf-2hkgm 3306:3306 --address 0.0.0.0

## Namespaces
kubectl get namespaces
kubectl create namespace test
kubectl get pods -n test

## Describe command
kubectl describe <resource> <name>

## Version
kubectl version

service

  • type: LoadBalancer
  • type: ClusterIP
  • type: NodePort

ingress

kubernetes/ingress-nginx : from github

Helm NGINX Ingress : from helm

dashboard

kubernetes/dashboard : from github

kubernetes-dashboard : from helm

tools

  • minikube : k8s
  • skaffold : k8s 開發工具
  • service mesh & istio : sidecar , 保護 k8s
  • kiali : k8s 視圖整合 , labels: app: xxxxx
  • argocd : cd , auto pull k8s yaml file from github
  • prometheus : cd 監控 => labels: release: prometheus
  • EFK(Fluent-Bit) : log
  • kustmize : yaml file 合併
  • okteto : online k8s , 部屬 pod
  • buildah : OCI image builder : like docker build
  • kaniko : k8s 中構建 image 工具
  • skopeo : OCI 鏡像命令 : skopeo copy -dest-tls-verifymfalse docker-daemon:au.icr.io/rhay/helloworld:ve.1 oci:helloworld_oci
  • dive : 命令用來查看 image 狀況
  • pulumi : IaC

ref