Kubernetes Cheetset
Viewing and finding resourcesโ
Podsโ
Get List Pods
kubectl get pods -n <namespace>
Get Top Pods
kubectl top pods -n <namespace>
Describe Pods
kubectl describe pods <namepods>
Serviceโ
Restart Service
kubectl rollout restart deployment <nameservice> -n <namespace>
Get List Service
kubectl get svc -n <namespace>
Creating Objectsโ
Create Resource(s)
kubectl apply -f ./my.yaml
Create From Multiple Files
kubectl apply -f ./my1.yaml -f ./my2.yaml
Create Resource(s) In All Manifest Files In Dir
kubectl apply -f ./dir
Create Resource(s) From Url
kubectl apply -f <https://git.io/vPieo>
Start a Single Instance of Nginx
kubectl create deployment nginx --image=nginx #
๐ Mengelola Context di Kubernetes dengan kubectl
โ
Kubernetes menggunakan konsep context dalam file kubeconfig
untuk mengelola akses ke beberapa cluster. Context mencakup informasi tentang:
- Cluster
- User
- Namespace (opsional)
๐ Melihat Context Saat Iniโ
kubectl config current-context
๐ Melihat Semua Contextโ
kubectl config get-contexts
๐ Berpindah Contextโ
kubectl config use-context <nama-context>
๐งน Menghapus Contextโ
kubectl config delete-context <nama-context>
๐ Melihat Konfigurasi kubeconfigโ
kubectl config view --minify
Reference
k8s-commands
k8s-cheetset