k8s 常用命令

 
 

[root@master ~]# kubectl get nodes

NAME      STATUS    ROLES     AGE       VERSION

master    Ready     master    1h        v1.8.1

node1     Ready     <none>    1h        v1.8.1

node2     Ready     <none>    1h        v1.8.1
View Code

 

[root@master network]#  kubectl get po --all-namespaces

NAMESPACE     NAME                             READY     STATUS    RESTARTS   AGE

kube-system   etcd-master                      1/1       Running   0          3m

kube-system   kube-apiserver-master            1/1       Running   0          4m

kube-system   kube-controller-manager-master   1/1       Running   0          4m

kube-system   kube-dns-545bc4bfd4-kvvg2        3/3       Running   0          4m

kube-system   kube-flannel-ds-djdp4            2/2       Running   1          21s

kube-system   kube-flannel-ds-mb75s            2/2       Running   0          1m

kube-system   kube-flannel-ds-sxpkq            2/2       Running   1          18s

kube-system   kube-proxy-6s8wz                 1/1       Running   0          21s

kube-system   kube-proxy-d4snf                 1/1       Running   0          4m

kube-system   kube-proxy-lnxfv                 1/1       Running   0          18s

kube-system   kube-scheduler-master            1/1       Running   0          4m
View Code

 kubectl get svc

NAME         TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)   AGE

kubernetes   ClusterIP   10.96.0.1    <none>        443/TCP   8m
View Code

kubectl logs -f kubernetes-dashboard-759ccc86d9-svmlk --namespace=kube-system

2018/02/07 05:23:45 Starting overwatch

2018/02/07 05:23:45 Using in-cluster config to connect to apiserver

2018/02/07 05:23:45 Using service account token for csrf signing

2018/02/07 05:23:45 No request provided. Skipping authorization

2018/02/07 05:23:45 Successful initial request to the apiserver, version: v1.8.2

2018/02/07 05:23:45 New synchronizer has been registered: kubernetes-dashboard-key-holder-kube-system. Starting

2018/02/07 05:23:45 Starting secret synchronizer for kubernetes-dashboard-key-holder in namespace kube-system

2018/02/07 05:23:45 Generating JWE encryption key

2018/02/07 05:23:46 Storing encryption key in a secret

2018/02/07 05:23:46 Creating in-cluster Heapster client

2018/02/07 05:23:46 Metric client health check failed: the server could not find the requested resource (get services heapster). Retrying in 30 seconds.

2018/02/07 05:23:46 Serving insecurely on HTTP port: 9090

2018/02/07 05:24:16 Metric client health check failed: the server could not find the requested resource (get services heapster). Retrying in 30 seconds.

2018/02/07 05:24:46 Metric client health check failed: the server could not find the requested resource (get services heapster). Retrying in 30 seconds.

2018/02/07 05:25:16 Metric client health check failed: the server could not find the requested resource (get services heapster). Retrying in 30 seconds.

2018/02/07 05:25:46 Metric client health check failed: the server could not find the requested resource (get services heapster). Retrying in 30 seconds.
View Code

kubectl get pods -n kube-system -o wide

NAME                                    READY     STATUS    RESTARTS   AGE       IP           NODE

etcd-master                             1/1       Running   0          7m        10.10.6.11   master

kube-apiserver-master                   1/1       Running   0          8m        10.10.6.11   master

kube-controller-manager-master          1/1       Running   0          8m        10.10.6.11   master

kube-dns-545bc4bfd4-kvvg2               3/3       Running   0          8m        10.96.0.2    master

kube-flannel-ds-djdp4                   2/2       Running   1          4m        10.10.6.13   node2

kube-flannel-ds-mb75s                   2/2       Running   0          5m        10.10.6.11   master

kube-flannel-ds-sxpkq                   2/2       Running   1          4m        10.10.6.12   node1

kube-proxy-6s8wz                        1/1       Running   0          4m        10.10.6.13   node2

kube-proxy-d4snf                        1/1       Running   0          8m        10.10.6.11   master

kube-proxy-lnxfv                        1/1       Running   0          4m        10.10.6.12   node1

kube-scheduler-master                   1/1       Running   0          8m        10.10.6.11   master

kubernetes-dashboard-759ccc86d9-svmlk   1/1       Running   0          2m        10.96.2.2    node1
View Code

kubectl get svc  --all-namespaces

NAMESPACE     NAME                   TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)         AGE

default       kubernetes             ClusterIP   10.96.0.1       <none>        443/TCP         1h

kube-system   kube-dns               ClusterIP   10.96.0.10      <none>        53/UDP,53/TCP   1h

kube-system   kubernetes-dashboard   NodePort    10.104.11.151   <none>        80:31234/TCP    1h

[root@master ~]# 
View Code

 

转载于:https://www.cnblogs.com/sxwen/p/8426357.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值