kubectl create -f my-service.yaml -f my-rc.yaml #根据YAML配置文件一次性创建Service和RC kubectl apply -f app.yaml #如果存在则更新,不存在则创建 1. 2. 2.2.查看资源对象 kubectlgetnode#查看Node状态 kubectlgetpods pod1 pod2#获取多个pod的信息 kubectlgetpod <pod-name>-owide#...
kubectlget nodes-ojsonpath='{.items[*].status.addresses[?(@.type=="ExternalIP")].address}' # 列出属于某个特定 RC 的 Pods 的名称 # 在转换对于 jsonpath 过于复杂的场合,"jq" 命令很有用;可以在 https://stedolan.github.io/jq/ 找到它。 sel=${$(kubectl get rc my-rc --output=json...
监听到service被删除,则删除和该service同名的endpoint对象 监听到新的service被创建,则根据新建service信息获取相关pod列表,然后创建对应endpoint对象 监听到service被更新,则根据更新后的service信息获取相关pod列表,然后更新对应endpoint对象 监听到pod事件,则更新对应的service的endpoint对象,将pod IP记录到endpoint中 Kube-...
$ kubectl get nodes -o jsonpath='{.items[*].status.addresses[?(@.type=="ExternalIP")].address}' # 列出属于某个 PC 的 Pod 的名字 #“jq”命令用于转换复杂的 jsonpath,参考 https://stedolan.github.io/jq/ $ sel=${$(kubectl get rc my-rc --output=json | jq -j'.spec.selector | t...
# 获取所有节点的 ExternalIP$ kubectl get nodes -o jsonpath='{.items[*].status.addresses[?(@.type=="ExternalIP")].address}' # 列出属于某个 PC 的 Pod 的名字# “jq”命令用于转换复杂的 jsonpath,参考 https://stedolan.github.io/jq/$ sel...
Address: 10.11.0.10#53 Name: kubernetes.default.svc.cluster.local Address: 10.11.0.1 如果想知道是否正确创建了服务,还可以查看 k get endpoints,并仔细检查标签选择器。 例如 k get svc alex-echo -o wide NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE SELECTOR alex-echo ClusterIP 10.11....
In 0.18.1 on Google Container Engine, I have a service with createExternalLoadBalancer=true. The load balancer is created and works as expected, but neither kubectl get service nor kubectl describe service include the LB IP. This worked in 0.17.1. Output of kubectl get service (condensed to...
###左右滑动foriin`kubectl get node --no-headers| awk '{print $1}'`;doecho $i;ssh-q`kubectl get node $i -o jsonpath='{.status.addresses[0].address}'`"ping <DST IP> -c 2";echo;echo;done 对于云原生环境来说,将Linux的基础命令和云原生的命令结合起来会得到意想不到的效果,可以大大的...
selector=app=cassandra rc -o \ jsonpath='{.items[*].metadata.labels.version}' # 获取所有节点的 ExternalIP $ kubectl get nodes -o jsonpath='{.items[*].status.addresses[?(@.type=="ExternalIP")].address}' # 列出属于某个 PC 的Pod 的名字 # “jq”命令用于转换复杂的 jsonpath,参考 https...
svc:Service ds:DaemonSet deploy:Deployment rs:ReplicaSet sts:StatefulSet cj:CronJob 输出选项 kubectl [command] [TYPE] [NAME] -o=<output_format> 常用-o yaml,一般使用yaml文件,看的比json清晰,配置项太多了json的花括号看着很乱。 实战 基本命令 ...