zoukankan      html  css  js  c++  java
  • 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
  • 相关阅读:
    Notes about "Exploring Expect"
    Reuse Sonar Checkstyle Violation Report for Custom Data Analysis
    Eclipse带参数调试的方法
    MIT Scheme Development on Ubuntu
    Manage Historical Snapshots in Sonarqube
    U盘自动弹出脚本
    hg的常用配置
    Java程序员的推荐阅读书籍
    使用shared memory 计算矩阵乘法 (其实并没有加速多少)
    CUDA 笔记
  • 原文地址:https://www.cnblogs.com/sxwen/p/8426357.html
Copyright © 2011-2022 走看看