创建deployment(简写deploy):kubectl create deployment nginx-dp --image=nginx:1.7.9 -n kube-public 查看deployment : kubectl get deployment -n kube-public 展示扩展信息(-o wide):kubectl get pods -n kube-public -o wide 看详细信息:kubectl describe deployment nginx-dp -n kube-public 进入pod:kubect...
kubectldeletepods,services -l name=myLabel# 删除包含 name=myLabel 标签的 pods 和服务 kubectl -nmy-nsdeletepod,svc --all# 删除在 my-ns 名字空间中全部的 Pods 和服务 # 删除所有与 pattern1 或 pattern2 awk 模式匹配的 Pods kubectl get pods -n mynamespace --no-headers=true | awk'/pattern...
创建方法 获得yaml kubectl create deployment web --image=nginx -o yaml --dry-run >m1.yaml # 不运行,只生成yaml 1. 2. 已经运行的导出 yaml kubectl get deploy NAME READY UP-TO-DATE AVAILABLE AGE nginx 1/1 1 1 10d kubectl get deploy nginx -o=yaml --export > m2.yaml 我的是新版本,去...
$ kubectlgetpod mypod-o yaml|sed's/\(image: myimage\):.*$/\1:v4/'|kubectl replace-f-$ kubectl label pods my-podnew-label=awesome # 添加标签 $ kubectl annotate pods my-pod icon-url=http://goo.gl/XXBTWq # 添加注解 $ kubectl autoscale deployment foo--min=2--max=10# 自动扩展 ...
[root@master ~]# kubectl get pods -o wide NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES nginx 1/1 Running 0 3m43s 10.244.2.11 node2.example.com <none> <none> //暴露端口号 [root@master ~]# kubectl run nginx --image nginx --port 80 ...
~$ kubectl get pod nginx1 --template '{{.status.podIP}}' Attached is the output: When this command is executed, we can easily see the list of all pods along with their status and IP address. As seen in the previous command, we use the –– template option which allows us to speci...
$ kubectl getpods --all-namespaces $ kubectl getpods --namespace <namespaceName>- sample output -NAME READY STATUS RESTARTS AGE runner-ctrl-71c8ff88-bc9pq 2/2 Running 0 5m5s To get the Pod containers, execute the following command and search for the “Containers”: ...
kubectl get rc/web service/frontend pods/web-pod-13je7 选项: -A, --all-namespaces=false: If present, list the requested object(s) across all namespaces. Namespace in current context is ignored even if specified with --namespace.
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES a9ec34d98787 nginx "nginx -g 'daemon of 8 minutes ago Up 8 minutes 0.0.0.0:80->80/tcp, 443/tcp nginx-app $ docker attach a9ec34d98787 ... kubectl: $ kubectl get pods NAME READY STATUS RESTARTS AGE ...
image: nginx imagePullPolicy: IfNotPresent kubectl apply -f nginx.yaml kubectl get pods | grep nginx 查看所有 pod 资源对象的标签 kubectl get pods --show-labels my-nginx 1/1 Running 0 51s run=my-nginx tomcat-pod 1/1 Running 0 7m20s app=tomcat-pod ...