sh Kubernetes备忘单

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh Kubernetes备忘单相关的知识,希望对你有一定的参考价值。

## MiniKube

# Starting Minikube
minikube start

# Run Hello World
kubectl run hello-world --replicas=2 --labels="run=load-balancer-example" --image=gcr.io/google-samples/node-hello:1.0  --port=8080

# Get Deployments
kubectl get deployments hello-world

# Describe Deployments
kubectl describe deployments hello-world

# Expose Service
kubectl expose deployment hello-world --type=NodePort --name=example-service

# Describe Services
kubectl describe services example-service
kubectl describe svc example-service

# Delete Pods
kubectl delete pods <podname>

# Running Kubernetes Pod
kubectl run <PodName> --image=<image_name> -l app=appName,env=prod,version=1.0 -r 2

# Delete Pod
kubectl delete pod <podName>

# Get Deployment Information
kubectl get deployments

# Applying KubeCtl Applying Resource Configuration
kubectl apply -f <file1> -f <file2>

# Scale Deployments
kubeclt scale deployment guestbook-service --replica=1











# Kubernetes Configs

# Get Kubernetes Contexts
kubectl config get-contexts

# Display the current Context
kubectl config current-context

# Set the Default Context to <context-name>
kubectl config use-context <context-name>


-----

# Viewing, Finding Resources

$ kubectl get pods
$ kubectl get pods --all-namespaces             # List all pods in all namespaces
$ kubectl get deployment my-dep                 # List a particular deployment

# Describe with Verbose Output
$ kubectl describe pods my-pod

# Interacting with Pods
$ kubectl logs my-pod                                 # dump pod logs (stdout)
$ kubectl logs -f my-pod                              # stream pod logs (stdout)
$ kubectl attach my-pod -i                            # Attach to Running Container
$ kubectl exec my-pod -- ls /                         # Run command in existing pod (1 container case)

以上是关于sh Kubernetes备忘单的主要内容,如果未能解决你的问题,请参考以下文章

sh Azure命令备忘单

sh 备忘单

sh InfluxDB备忘单

sh Linux备忘单

sh Salesforce SFDX备忘单

sh 发电机备忘单