This essay before affixing two chapters, and the establishment of the master node from the master node01, node02, node03 three nodes
kubectl subcommand
master ~]# kubectl
kubectl controls the Kubernetes cluster manager. Find more information at: https://kubernetes.io/docs/reference/kubectl/overview/ 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 Basic Commands (Intermediate): explain Documentation of resources get Display one or many resources //查 edit Edit a resource on the server // changes delete Delete resources by filenames, stdin, resources and names, or by resources and label selector // delete Deploy Commands: rollOut at The rollOut of the Manage Resource // A scroll Scale the Set A new new size for a Deployment, ReplicaSet, Replication Controller, or Job // manually change the application of the scale AutoScale Auto - scale Deployment a, ReplicaSet, or ReplicationController // automatically changes that create HPA cluster management Commands: // cluster management certificate Modify certificate resources. cluster - info info // Display cluster cluster information top Display Resource (CPU/ Memory / the Storage) Usage. Cordon Node Mark AS unschedulable mark // can not be called a node uncordon Node Mark AS Schedulable // tag node may be invoked Drain Drain Node in Preparation for Maintenance taint taints the Update The ON // Nodes One or More stain to a node increases, the control function is invoked if the Troubleshooting and Debugging the Commands: dESCRIBE the Show Details of resource or Group a specific details of resources // description of the resource, e.g. ~ Master] node # kubectl dESCRIBE amdha01 logs the Print the logs for a Container in A POD The attach to the Attach 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: diff Diff live version against would-be applied version 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 wait Experimental: Wait for a specific condition on one or many resources. convert Convert config files between different API versions kustomize Build a kustomization target from a directory or a remote url. 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-resources Print the supported API resources on the server api-versions Print the supported API versions on the server, in the form of "group/version" config Modify kubeconfig files plugin Provides utilities for interacting with plugins. version Print the client and server version information Usage: kubectl [flags] [options] 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).
Detailed description of a resource
[root@master ~]# kubectl describe node master Name: master Roles: master Labels: beta.kubernetes.io/arch=amd64 beta.kubernetes.io/os=linux kubernetes.io/arch=amd64 kubernetes.io/hostname=master kubernetes.io/os=linux node-role.kubernetes.io/master= Annotations: flannel.alpha.coreos.com/backend-data: {"VtepMAC":"2e:6c:70:78:ed:70"} flannel.alpha.coreos.com/backend-type: vxlan flannel.alpha.coreos.com/kube-subnet-manager: true flannel.alpha.coreos.com/public-ip: 192.168.184.141 kubeadm.alpha.kubernetes.io/cri-socket: /var/run/dockershim.sock node.alpha.kubernetes.io/ttl: 0 volumes.kubernetes.io/controller-managed-attach-detach: true CreationTimestamp: Fri, 31 May 2019 20 is : 34 is : 59 + 0800 Taints: node-role.kubernetes.io/ master: // NoSchedule that as long as components are not the master can not be scheduled to the master Unschedulable: to false Conditions: the Type LastTransitionTime the Status LastHeartbeatTime the Message Reason ---- - ----- ----------------- ------------------ ------ ---- --- MemoryPressure False Mon, 03 On Jun 2019 22 is : 20 is : . 17 + 0800 Fri, 31 is On May2019 20:34:53 +0800 KubeletHasSufficientMemory kubelet has sufficient memory available DiskPressure False Mon, 03 Jun 2019 22:20:17 +0800 Fri, 31 May 2019 20:34:53 +0800 KubeletHasNoDiskPressure kubelet has no disk pressure PIDPressure False Mon, 03 Jun 2019 22:20:17 +0800 Fri, 31 May 2019 20:34:53 +0800 KubeletHasSufficientPID kubelet has sufficient PID available Ready True Mon, 03 Jun 2019 22:20:17 +0800 Mon, 03 Jun 2019 22:06:07 +0800 KubeletReady kubelet is posting ready status Addresses: InternalIP: 192.168.184.141 Hostname: master Capacity: cpu: 4 ephemeral-storage: 12786Mi hugepages-1Gi: 0 hugepages-2Mi: 0 memory: 1867048Ki pods: 110 Allocatable: cpu: 4 ephemeral-storage: 12066383443 hugepages-1Gi: 0 hugepages-2Mi: 0 memory: 1764648Ki pods: 110 System Info: Machine ID: 45c658713b3b423387314d097b36aa61 System UUID: 7C8C4D56-7732-E896-C85E-040A2FCEF804 Boot ID: 474da659-6243-4a63-a5f9-2e436260b3d2 Kernel Version: 3.10.0-693.el7.x86_64 OS Image: CentOS Linux 7 (Core) Operating System: linux Architecture: amd64 Container Runtime Version: docker://18.9.6 Kubelet Version: v1.14.2 Kube-Proxy Version: v1.14.2 PodCIDR: 10.244.0.0/24 Non-terminated Pods: (8 in total) Namespace Name CPU Requests CPU Limits Memory Requests Memory Limits AGE --------- ---- ------------ ---------- --------------- ------------- --- kube-system coredns-fb8b8dccf-42b7j 100m (2%) 0 (0%) 70Mi (4%) 170Mi (9%) 3d1h kube-system coredns-fb8b8dccf-bjv95 100m (2%) 0 (0%) 70Mi (4%) 170Mi (9%) 3d1h kube-system etcd-master 0 (0%) 0 (0%) 0 (0%) 0 (0%) 3d1h kube-system kube-apiserver-master 250m (6%) 0 (0%) 0 (0%) 0 (0%) 3d1h kube-system kube-controller-manager-master 200m (5%) 0 (0%) 0 (0%) 0 (0%) 3d1h kube-system kube-flannel-ds-amd64-w4jfh 100m (2%) 100m (2%) 50Mi (2%) 50Mi (2%) 2d18h kube-system kube-proxy-f88gd 0 (0%) 0 (0%) 0 (0%) 0 (0%) 3d1h kube-system kube-scheduler-master 100m (2%) 0 (0%) 0 (0%) 0 (0%) 3d1h Allocated resources: (Total limits may be over 100 percent, i.e., overcommitted.) Resource Requests Limits -------- -------- ------ cpu 850m (21%) 100m (2%) memory 190Mi (11%) 390Mi (22%) ephemeral-storage 0 (0%) 0 (0%) Events: Type Reason Age From Message ---- ------ ---- ---- ------- Normal Starting 14m kubelet, master Starting kubelet. Normal NodeHasSufficientMemory 14m kubelet, master Node master status is now: NodeHasSufficientMemory Normal NodeHasNoDiskPressure 14m kubelet, master Node master status is now: NodeHasNoDiskPressure Normal NodeHasSufficientPID 14m kubelet, master Node master status is now: NodeHasSufficientPID Normal NodeNotReady 14m kubelet, master Node master status is now: NodeNotReady Normal NodeAllocatableEnforced 14m kubelet, master Updated Node Allocatable limit across pods Normal NodeReady 14m kubelet, master Node master status is now: NodeReady
[root @ Master ~ ] # kubectl Version // View Client Server editions and Client Version: version.Info {Major: " 1 " , Minor: " 14 " , GitVersion: " v1.14.2 " , GitCommit: " 66049e3b21efe110454d67df4fa62b08ea79a19b " , GitTreeState: " Clean " ,
buildDate: " 2019-05-16T16: 23: 09Z " , GoVersion: " go1.12.5 " , Compiler: " gc " , Platform: " Linux / AMD64 "} Server Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.2", GitCommit:"66049e3b21efe110454d67df4fa62b08ea79a19b", GitTreeState:"clean",
BuildDate:"2019-05-16T16:14:56Z", GoVersion:"go1.12.5", Compiler:"gc", Platform:"linux/amd64"}
[root @ Master ~] # kubectl Cluster- info // view the cluster information Kubernetes MasterISrunning AT HTTPS://192.168.184.141:6443 // output externally API Server address KubeDNSISrunning AT HTTPS://192.168.184.141 : 6443 / API / V1 / Namespaces / Kube-System / Services / Kube-DNS: DNS / proxy
// corresponds CoreDNS, acquiring running path, proxy access method forwarded from the port of the external access execution cluster to further debug and Cluster Problems Diagnose, use'kubectl the dump Cluster-info'.
Three important accessory: kube-proxy, CoreDNS, flannel
How CRUD clusters of k8s