Kubernetes Common Commands

Source: Internet
Author: User
Tags etcd

Kubectl related
  • Keyword Concepts
    Pods
    Labels
    Replication Controller
    Services
    Volumes
    Kubectl Command Detailed description

  • Get pod List

    The # command returns the list of pods that are currently created by the kubernetes, mainly displaying the following message  # NAME ready     STATUS    restarts   age$ kubectl get pod # NAME Ready STATUS restarts Age# etcd-global-9002d 1/1 Running 0 2d# etcd-global-l3ph8 1/1 Running 0 2d
                   
                    # etcd-global-psj52 1/1 Running 0 2d 
                      
  • View pod Details

    # Use pod name to view pod details, mainly container details $ kubectl describe pod etcd-global-9002d
  • Querying the Deployment list

    # Get Deployment List $ kubectl Get deployment
  • Remove deployment

    # Remove the deployment named Etcd-minikube $ kubectl Delete deployment Etcd-minikube
  • Delete Container

    # Remove RC, that is, remove all containers of the RC control $ kubectl Delete rc My-nginx# Delete svc, that is, delete the assigned virtual ip$ kubectl Delete svc my-ngin
  • Get Replication Controller

    # Get Replication Controller list $ kubectl get RC
  • External access to KUBECTL internal ports

    The # Expose command will create a service that associates a random port on a local (on a node) to a container of 80 ports $ kubectl expose RC My-nginx--port=80--type=loadbalancer
  • Enquiry Service Information

    # above through expose created a service called My-nginx, we can query the services information by the following command $ kubectl get Svc My-nginx
  • To create a pod from a configuration file

    # Create containers based on configuration file *.yaml $ kubectl create-f./hello-world.yaml
  • Configuration file Correctness Check

    # Use the--vaildate parameter to verify the configuration file correctness $ kubectl create-f./hello-world.yaml--validate
  • View Logs

    # view Vttablet logs $ kubectl logs vttablet-100 Vttablet# view Vttablet in MySQL log $ kubectl logs vttablet-100 MySQL 
  • Shell Login

    EXEC vttablet-100-c vttablet-t-i--bash-il
  • View service Details

    Kubectl Describe service Etcd-global
  • RC Copy Number modification

    # Dynamic capacity scaling can be achieved by locally dynamically modifying the number of RC copies Kubectl scale RC xxxx--replicas=3
  • Query Replica Set

    Kubectl Get RS
  • View Endpoints List

    # View Endpoints list  # Endpoint = (Pod Ip + containerport) kubectl get Endpoints
  • View namespaces

    Kubectl Get namespace
  • Node isolation and Recovery

    ' {' spec ': {' unschedulable ': ' True}}'{' spec ': {' unschedulable ': true}'# Quarantine can also be passed Kubectl replace-f Xxx.yaml Command Implementation   
  • Pod Add/Remove/Modify Label

    # to pod xxx add lable app=vitesskubectl label pod xxx app=vitess# remove pod xxx lable appkubectl label pod xxx app-  # Modify pod xxx label kubectl label pod xxx app=mysql--overwrite 
  • Viewing pod logs

    <pod_name<container_name> 

Kubernetes Common Commands

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.