• 2018-01-01
  • 252
  • 36
  • 0


[root@k8s-master ~]#kubectl 
kubectl controls the Kubernetes cluster manager. 

Find more information at https://github.com/kubernetes/kubernetes.

Basic Commands (Beginner):
  create         Create a resource from a file or from stdin.
  expose         Take a replication controller, service, deployment or pod and expose it as a new Kubernetes Service
  run            Run a particular image on the cluster
  set            Set specific features on objects
  run-container  Run a particular image on the cluster. This command is deprecated, use "run" instead

Basic Commands (Intermediate):
  get            Display one or many resources
  explain        Documentation of resources
  edit           Edit a resource on the server
  delete         Delete resources by filenames, stdin, resources and names, or by resources and label selector

Deploy Commands:
  rollout        Manage the rollout of a resource
  rolling-update Perform a rolling update of the given ReplicationController
  scale          Set a new size for a Deployment, ReplicaSet, Replication Controller, or Job
  autoscale      Auto-scale a Deployment, ReplicaSet, or ReplicationController

Cluster Management Commands:
  certificate    Modify certificate resources.
  cluster-info   Display cluster info
  top            Display Resource (CPU/Memory/Storage) usage.
  cordon         Mark node as unschedulable
  uncordon       Mark node as schedulable
  drain          Drain node in preparation for maintenance
  taint          Update the taints on one or more nodes

Troubleshooting and Debugging Commands:
  describe       Show details of a specific resource or group of resources
  logs           Print the logs for a container in a pod
  attach         Attach to a running container
  exec           Execute a command in a container
  port-forward   Forward one or more local ports to a pod
  proxy          Run a proxy to the Kubernetes API server
  cp             Copy files and directories to and from containers.
  auth           Inspect authorization

Advanced Commands:
  apply          Apply a configuration to a resource by filename or stdin
  patch          Update field(s) of a resource using strategic merge patch
  replace        Replace a resource by filename or stdin
  convert        Convert config files between different API versions

Settings Commands:
  label          Update the labels on a resource
  annotate       Update the annotations on a resource
  completion     Output shell completion code for the specified shell (bash or zsh)

Other Commands:
  api-versions   Print the supported API versions on the server, in the form of "group/version"
  config         Modify kubeconfig files
  help           Help about any command
  plugin         Runs a command-line plugin
  version        Print the client and server version information

Use "kubectl <command> --help" for more information about a given command.
Use "kubectl options" for a list of global command-line options (applies to all commands).



kubectl version


kubectl api-versions


kubectl explain 组件名称

kubectl get

-o wide          #以纯文本格式输出任何附加信息。
-n namespace     #指定namespace,若不加该参数,默认namespace为default。
--all-namespaces #显示所有namespace,和-n不能同时使用。
-f file          #指定配置文件。


kubectl get pod --all-namespaces -o wide


kubectl get pod -n namespace -o wide


kubectl get pod podname -n namespace -o wide


kubectl get svc --all-namespaces -o wide


kubectl get deploy --all-namespaces


  • christian louboutin shoes回复

    Thank you a lot for providing individuals with such a brilliant opportunity to read articles and blog posts from this blog. It’s usually so superb and stuffed with a good time for me personally and my office fellow workers to visit your website not less than three times in one week to read the fresh items you will have. And lastly, I’m also at all times pleased concerning the special knowledge you give. Selected 4 ideas in this article are definitely the simplest I’ve had.

  • coach outlet store回复

    My husband and i have been quite comfortable when Peter managed to deal with his web research with the precious recommendations he had out of the blog. It is now and again perplexing to simply find yourself giving freely information and facts which often the others may have been selling. We know we have the blog owner to appreciate because of that. Those illustrations you have made, the simple blog navigation, the friendships your site help to create – it’s most terrific, and it’s really helping our son and us reason why that concept is interesting, and that’s really important. Thank you for everything!

  • off white hoodie回复

    I simply wanted to thank you so much once again. I am not sure the things I could possibly have sorted out in the absence of the ways contributed by you over this situation. It absolutely was an absolute terrifying difficulty in my view, but understanding a skilled tactic you handled that took me to leap with gladness. I will be grateful for your service and in addition have high hopes you comprehend what a great job you’re getting into educating the mediocre ones using a web site. Probably you have never got to know all of us.

  • hermes belt回复

    I and my pals ended up taking note of the excellent key points located on the blog and so all of the sudden I got an awful suspicion I had not thanked you for those techniques. All the young boys had been certainly excited to see all of them and have surely been making the most of these things. Many thanks for turning out to be really accommodating as well as for choosing such awesome subjects most people are really desirous to discover. Our own sincere regret for not expressing appreciation to you sooner.

  • canada goose回复

    Thanks a lot for giving everyone an extremely memorable opportunity to read in detail from this web site. It can be very kind and stuffed with fun for me and my office fellow workers to search your blog particularly thrice in one week to learn the latest guidance you have. Not to mention, we are always pleased with all the astounding advice you give. Certain 2 facts in this post are in reality the most impressive I have had.

  • cheap jordans回复

    Thanks so much for providing individuals with remarkably remarkable chance to read articles and blog posts from this site. It really is very pleasing and as well , jam-packed with amusement for me personally and my office co-workers to search your site at minimum 3 times in 7 days to learn the fresh stuff you will have. And indeed, we’re at all times astounded with all the fantastic tips you serve. Certain two areas on this page are indeed the best we’ve had.

  • retro jordans回复

    I’m also commenting to make you know of the excellent discovery my friend’s daughter encountered reading your blog. She mastered so many issues, which include what it’s like to have an awesome helping character to let many people smoothly gain knowledge of a number of specialized issues. You actually did more than my desires. Many thanks for supplying such warm and helpful, trustworthy, explanatory not to mention fun tips on your topic to Lizeth.

  • adidas superstars回复

    I actually wanted to make a simple note in order to express gratitude to you for these pleasant facts you are placing at this website. My long internet research has at the end been rewarded with excellent content to talk about with my colleagues. I would suppose that many of us readers actually are unequivocally endowed to exist in a perfect place with so many perfect individuals with insightful opinions. I feel extremely privileged to have encountered your entire webpage and look forward to some more pleasurable moments reading here. Thank you again for a lot of things.

  • golden goose outlet回复

    I am just commenting to make you be aware of what a terrific discovery my cousin’s child went through browsing the blog. She mastered a wide variety of details, which include what it is like to possess a very effective coaching spirit to make a number of people quite simply fully understand specific tricky issues. You truly exceeded our expectations. Thanks for coming up with such invaluable, trustworthy, edifying and in addition easy tips about that topic to Mary.

  • nike air max 95回复

    I am writing to let you be aware of of the excellent discovery my friend’s girl found reading through your webblog. She came to understand some things, not to mention what it is like to possess a wonderful teaching mindset to make a number of people without problems master selected grueling subject areas. You really did more than visitors’ desires. Thanks for giving those great, healthy, informative and in addition easy guidance on this topic to Ethel.

  • nike cortez men回复

    I want to express my gratitude for your generosity giving support to individuals who require help on this important topic. Your real dedication to passing the message all around appeared to be rather advantageous and has really encouraged many people like me to achieve their dreams. This warm and helpful hints and tips indicates so much to me and even further to my office colleagues. Many thanks; from all of us.

  • nmd回复

    A lot of thanks for all your valuable labor on this blog. Ellie delights in getting into internet research and it’s easy to understand why. My partner and i know all concerning the powerful means you convey invaluable items on the website and as well as improve response from the others on the issue while our princess is truly becoming educated a whole lot. Take pleasure in the rest of the new year. You are carrying out a fantastic job.

  • longchamp回复

    I must show thanks to you just for bailing me out of such a problem. Because of browsing throughout the the net and finding strategies that were not productive, I thought my life was well over. Being alive minus the strategies to the issues you’ve fixed by way of your main blog post is a critical case, and the kind which might have badly damaged my career if I had not noticed the blog. Your own personal skills and kindness in maneuvering all the pieces was excellent. I am not sure what I would have done if I hadn’t encountered such a point like this. I’m able to at this time look forward to my future. Thanks a lot very much for this professional and result oriented help. I will not be reluctant to refer your web site to any individual who needs guidance on this matter.

  • michael kors sale回复

    I have to express my appreciation to this writer for rescuing me from such a matter. As a result of browsing through the world-wide-web and seeing notions that were not beneficial, I was thinking my entire life was well over. Living devoid of the strategies to the issues you have resolved as a result of your report is a crucial case, as well as ones that would have in a negative way damaged my career if I hadn’t encountered your web site. Your actual ability and kindness in controlling all things was very useful. I am not sure what I would have done if I hadn’t discovered such a solution like this. I can also at this time look forward to my future. Thank you very much for this specialized and result oriented help. I will not hesitate to propose the blog to anyone who should have direction on this topic.

  • christian louboutin outlet回复

    Thank you a lot for providing individuals with a very pleasant chance to read articles and blog posts from this site. It is often very useful plus full of a good time for me personally and my office fellow workers to visit your site more than 3 times a week to see the newest items you have got. Not to mention, I am just at all times fascinated concerning the striking thoughts served by you. Selected 2 areas on this page are absolutely the simplest we have all ever had.

  • vapormax回复

    I wish to convey my respect for your kindness in support of individuals that require help with this particular subject. Your personal dedication to getting the message all through was especially advantageous and have in most cases encouraged employees like me to realize their pursuits. Your new invaluable information entails much a person like me and additionally to my fellow workers. Regards; from everyone of us.