發表文章

目前顯示的是 2月, 2025的文章

02 - Manual Scheduling

Q: Manually schedule the pod on "node01"   kubectl replace --force    =  kubectl delete  +  kubectl create Method 1: kubectl replace $ vim nginx.yaml                                   $ kubectl replace --force -f nginx.yaml       --- apiVersion: v1 kind: Pod metadata: name: nginx spec: nodeName: node01 containers: - image: nginx name: nginx Method 2: kubectl delete + kubectl create Delete the existing pod first. $ kubectl delete po nginx To list and know the names of available nodes on the cluster: $ kubectl get nodes Add the "nodeName" field under the spec section in the nginx.yaml file with " node01 "  as the value: --- apiVersion: v1 kind: Pod metadata: name: nginx spec: nodeName: node01 containers: - image: nginx name: nginx Create a pod from the definition...

01 - Core Concepts - Imperative Commands

Imperative Commands $ kubectl run --help                                    $ kubectl create service --help                     $ kubectl create service clusterip --help        $ kubectl expose --help                               [Doc] kubectl expose kubectl expose 主要用來將 Kubernetes Pod、Deployment、ReplicaSet 或 Service 暴露成一個新的 Kubernetes Service,允許內部存取(ClusterIP)或外部存取(NodePort, LoadBalancer)。 $ kubectl run custom-nginx --image=nginx --port=8080            $ kubectl create deployment  < deployment -name>  --image= < image -name>  --replicas=2 -n  <namespace-name>        

01 - Core Concepts - Services

圖片
Services $ kubectl get service        $ kubectl get svc             That is a default service created by Kubernetes at launch. $ kubectl describe service                        $ kubectl describe svc <service-name>      Day 09 -【Basic Concept】:Service

01 - Core Concepts - Namespaces

圖片
Namespaces $ kubectl get namespaces                     $ kubectl get ns                                   $ kubectl get ns --no-headers | wc -l    Look for existing Namespaces. $ kubectl get pods --all-namespaces            $ kubectl get pods -A                                  $ kubectl get pods -o wide -A                                   $ kubectl get pods -o wide -A | grep  <xxx-name>        Q: How many pods exist in the research namespace? $ kubectl get pods --namespace= <namespace-name>                        $ kubectl get pod...

01 - Core Concepts - Deployments

圖片
Deployments $ kubectl get deployments          $ kubectl get deploy                  Get the current Deployments deployed. $ kubectl describe deploy <deployment-name>         Get detailed information about Deployment. $ kubectl explain deploy                             $ kubectl explain deploy | head -n3             Get the documentation of the resource and its fields. $ kubectl api-resources | grep deploy           

01 - Core Concepts - ReplicaSets

ReplicaSets $ kubectl get replicaset        $ kubectl get rs                   Get the current ReplicaSets deployed. $ kubectl describe rs  <replicaset-name>           Get detailed information about ReplicaSet. $ kubectl delete pod <pod-name1>  <pod-name2>   <pod-name3>      $ kubectl delete rs  <replicaset-name>                                           $ kubectl delete -f <file-name>.yaml                                             Delete pods/ReplicaSet. Q: Why are there still 4 PODs, even after you deleted one? A: ReplicaSet ensures that desired number of PODs always run Fix...

01 - Core Concepts - Pods

圖片
學習目標 Pods ReplicaSets Deployments Namespaces Services Imperative Commands Pods $ kubectl get pods                         $ kubectl get pod  <pod-name>       Look for existing Pods. $ kubectl get pods                        NAME       READY       STATUS               RESTARTS    AGE newpod     1  / 1           Running                0                  10m webapp     1  / 2          ImagePullBackOff   0                  2m49s READY   ➜  Running Containers in Pod  / Total Containers in Pod $ kubectl ge...