zoukankan      html  css  js  c++  java
  • K8S常用命令

    What is Kubernetes?

    Kubernetes is a platform for managing containerized workloads. Kubernetes orchestrates computing, networking and storage to provide a seamless portability across infrastructure providers

    Cluster Info

    > kubectl config
    > kubectl cluster -info
    > kubectl get componentstatuses

    Viewing Resource Information

    Nodes

    > kubectl get no
    > kubectl get no -o wide
    > kubectl describe no
    > kubectl get no -o yaml
    > kubectl get node --selector=[label_name]
    > kubectl get nodes -o jsonpath='{.items[*].status.addresses[?(@.type=="ExternalIP")].address}'
    > kubectl top node [ node_name]

    Pods

    > kubectl get po
    > kubectl get po -o wide
    > kubectl describe po
    > kubectl get po --show -labels
    > kubectl get po -l app=nginx
    > kubectl get po -o yaml
    > kubectl get pod [pod_name] -o yaml --export
    > kubectl get pod [pod_name] -o yaml --export > nameoffile.yaml
    > kubectl get pods --field-selector status.phase=Running

    Namespaces

    > kubectl get ns
    > kubectl get ns -o yaml
    > kubectl describe ns

    Services

    > kubectl get svc
    > kubectl describe svc
    > kubectl get svc -o wide
    > kubectl get svc -o yaml
    > kubectl get svc --show-labels

    Deployments

    > kubectl get deploy
    > kubectl describe deploy
    > kubectl get deploy -o wide
    > kubectl get deploy -o yaml

    ConfigMaps

    > kubectl get cm
    > kubectl get cm -n=[namespace]
    > kubectl get cm -n=[namespace] -o yaml 
    > kubectl get cm --all -namespaces
    > kubectl get cm --all -namespaces -o yaml

    Logs

    > kubectl logs [pod_name]
    > kubectl logs [pod_name] -n=[namespace]
    > kubectl logs --since=1h [pod_name]
    > kubectl logs --tail=20 [pod_name]
    > kubectl logs -f -c [container_name][pod_name]
    > kubectl logs [pod_name] > pod.log

    Secrets

    > kubectl get secrets
    > kubeclt get secrets -n=[namespace]
    > kubectl get secrets -n=[namespace] -o yaml 
    > kubectl get secrets --all -namespaces
    > kubectl get secrets -o yaml

    ReplicaSets

    > kubectl get rs
    > kubectl describe rs
    > kubectl get rs -o wide
    > kubectl get rs -o yaml
  • 相关阅读:
    .NET开源B2C商城项目AssionShop开始开发设计(发布3小时撤下)
    AssionShop开源B2C电子商务系统概述
    ASP.NET中在不同的子域中共享Session
    单元测试框架"艾信.NET单元测试工具(AssionUnit)"开发第二步
    asp.net mvc 分页控件 MvcPager修改;使用范围增大
    Linux服务器测试网络连通性
    如何使用python连接mysql数据库
    mysql数据库基础知识
    使用python创建数据库并插入数据
    Linux下查看日志用到的常用命令
  • 原文地址:https://www.cnblogs.com/momoyan/p/12775640.html
Copyright © 2011-2022 走看看