Tổng hợp các câu lệnh hay dùng nhất Kubenetes | Kubernetes Cheat Sheet

Search for a command to run...

No comments yet. Be the first to comment.
Root Android Emulator và cài Burp Suite CA để intercept HTTPS — hướng dẫn chi tiết cho Android 12+, bao gồm AVD, root, cài chứng chỉ hệ thống và khắc phục lỗi. Tải rootAVD về máy git clone https://gitlab.com/newbit/rootAVD.git hoặc tải nhanh tại đây ...

Cân bằng tải là người hùng thầm lặng của các ứng dụng web hiệu suất cao. Để có thể tăng tối đa khả năng sử dụng, bạn cần phải biết về các thuật toán của chúng. Hãy theo dõi bài viết để xem đó là gì nhé. 1. Round Robin Round Robin là hình thức cân bằ...

Nếu bạn thường xuyên build image bằng Docker, thì chắc các bạn cũng để ý khi build lại thì lần sau thường sẽ nhanh hơn phần trước. Nhanh như vậy đó là do Docker đã cache lại để quá trình build image của chúng ta được nhanh hơn. Tất nhiên cái gì cũng ...

Bài viết được mình sưu tầm với mục đích chia sẻ kiến thức cho mọi người, và không nhằm mục đích thương mại. Vì bài viết có nhiều từ tiếng anh chuyên môn nên mình sẽ để nguyên văn của tác giả để mọi người có thể hiểu dễ hơn.
Display endpoint details for the cluster’s master and services.
kubectl cluster-info
Show the Kubernetes version that is active on the server and client
kubectl version
Get the cluster’s configuration
kubectl config view
List the available API resources
kubectl api-resources
List everything
kubectl get all --all-namespaces
List the nodes
kubectl get node
Update the taints on nodes
kubectl taint node <node_name>
Delete a node
kubectl delete node <node_name>
List pods
kubectl get pod
Delete a pod
kubectl delete pod <pod_name>
See detailed state of a pods
kubectl describe pod <pod_name>
Create a pod
kubectl create pod <pod_name>
Run a command for a container inside a pod
kubectl exec <pod_name> -c <container_name> <command>
Get interactive shell on a pod
kubectl exec -it <pod_name> /bin/sh
See resource usage (CPU/Memory/Storage) for pods
kubectl top pod
Add/update the annotations of a pod
kubectl annotate pod <pod_name> <annotation>
Add/update the label of a pod
kubectl label pod <pod_name>
View the list of replication controllers
kubectl get rc
View the list of replication controllers by namespace
kubectl get rc --namespace="<namespace_name>"
Scale a ReplicaSet
kubectl scale --replicas=<expected_replica_num> replicaset <name>
List the deployments
kubectl get deployment
Show the precise status of single or multiple deployments.
kubectl describe deployment <deployment_name>
Edit and update the deployment.
kubectl edit deployment <deployment_name>
Create a new deployment
kubectl create deployment <deployment_name>
Delete a deployment
kubectl delete deployment <deployment_name>
Check the rollout status of a deployment
kubectl rollout status deployment <deployment_name>
Display Resource usage (CPU/Memory/Storage) for nodes
kubectl top node
See resource allocation per node
kubectl describe nodes | grep Allocated -A 5
List the pods running on a node
kubectl get pods -o wide | grep <node_name>
To annotate a node
kubectl annotate node <node_name>
Add or update the labels of a node
kubectl label nodes <your-node-name> <label>
Scale a Deployment
kubectl scale deployment <deployment-name> --replicas=<number-of-replicas>
Create a secret
kubectl create secret <name>
List secrets
kubectl get secrets
View details about secrets
kubectl describe secrets <name>
Delete a secret
kubectl delete secret <secret_name>
List the services
kubectl get services
View the detailed state of a service
kubectl describe services <name>
Expose a replication controller, deployment or pod as a new Kubernetes service
kubectl expose deployment [deployment_name]
Edit/update the definition of a service
kubectl edit service <name>
Commands in Kubectl can include optional flags. Here are a few examples of the most popular and helpful ones.
–o Format of output. (Suppose you wanted to list all of the pods in ps output format with additional information.)
kubectl get pods -o wide
Create any resource(pod/replicaset/deployment, etc) using a yaml/json file.
kubectl apply -f <xyz.yaml>
Nội dung bài viết này được mình tìm hiểu, tham khảo, đúc kết và tổng hợp lại từ nhiều nguồn. Mọi người có thể xem thêm các bài viết sau: