robot@rke-test-master-1:~$ sudo bash check.sh [sudo] password for robot: module ip6_udp_tunnel is not present, try to install... Successfully installed ip6_udp_tunnel! module ip_set is not present, try to install... Successfully installed ip_set! module ip_set_hash_ip is not present, try to install... Successfully installed ip_set_hash_ip! module ip_set_hash_net is not present, try to install... Successfully installed ip_set_hash_net! module iptable_mangle is not present, try to install... Successfully installed iptable_mangle! module iptable_raw is not present, try to install... Successfully installed iptable_raw! module veth is not present, try to install... Successfully installed veth! module vxlan is not present, try to install... Successfully installed vxlan! module xt_comment is not present, try to install... Successfully installed xt_comment! module xt_mark is not present, try to install... Successfully installed xt_mark! module xt_multiport is not present, try to install... Successfully installed xt_multiport! module xt_nat is not present, try to install... Successfully installed xt_nat! module xt_recent is not present, try to install... Successfully installed xt_recent! module xt_set is not present, try to install... Successfully installed xt_set! module xt_statistic is not present, try to install... Successfully installed xt_statistic! module xt_tcpudp is not present, try to install... Successfully installed xt_tcpudp!
robot@rke-test-master-1:~$ ssh-keygen Generating public/private rsa key pair. Enter file in which to save the key (/home/robot/.ssh/id_rsa): Created directory '/home/robot/.ssh'. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/robot/.ssh/id_rsa. Your public key has been saved in /home/robot/.ssh/id_rsa.pub. The key fingerprint is: SHA256:lWbqBm0dVE2gHQ0LaEQrbl/ufd2CmQN6G70xWcETaxg robot@rke-test-master-1 The key's randomart image is: +---[RSA 2048]----+ | oo.o.E*o | | oo = *oo | | ... B + * | | . o * . . o | | + S o . | | . = o.. o | | +.o.=+ ..| | ....o=+o o| | .o.oo . | +----[SHA256]-----+
配置免密登陆
1 2 3 4
#!/bin/bash for i in rke-test-master-01 rke-test-master-02 rke-test-master-03 rke-test-node-01;do ssh-copy-id robot@${i} done
robot@rke-test-master-01:~$ rke up ..... ..... INFO[0040] [addons] Executing deploy job rke-coredns-addon INFO[0045] [addons] CoreDNS deployed successfully.. INFO[0045] [dns] DNS provider coredns deployed successfully INFO[0045] [ingress] Metrics Server is disabled, skipping Metrics server installation INFO[0045] [ingress] ingress controller is disabled, skipping ingress controller INFO[0045] [addons] Setting up user addons INFO[0045] [addons] no user addons defined INFO[0045] Finished building Kubernetes cluster successfully
root@rke-test-master-01:/home/robot# kubectl --kubeconfig kube_config_cluster.yml cluster-info Kubernetes master is running at https://180.153.180.33:6443 CoreDNS is running at https://180.153.180.33:6443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'. root@rke-test-master-01:/home/robot# kubectl version --client Client Version: version.Info{Major:"1", Minor:"15", GitVersion:"v1.15.11", GitCommit:"d94a81c724ea8e1ccc9002d89b7fe81d58f89ede", GitTreeState:"clean", BuildDate:"2020-03-12T21:08:59Z", GoVersion:"go1.12.17", Compiler:"gc", Platform:"linux/amd64"} root@rke-test-master-01:/home/robot# kubectl --kubeconfig kube_config_cluster.yml get nodes NAME STATUS ROLES AGE VERSION 180.153.180.11 Ready controlplane,etcd,master 48m v1.15.11 180.153.180.23 Ready controlplane,etcd,master 49m v1.15.11 180.153.180.33 Ready controlplane,etcd,master 48m v1.15.11 180.153.180.34 Ready worker 48m v1.15.11
robot@rke-test-master-01:~$ rke etcd snapshot-save --config cluster.yml --name snapshot-name INFO[0000] Running RKE version: v1.0.5 INFO[0000] Starting saving snapshot on etcd hosts INFO[0000] [dialer] Setup tunnel for host [180.153.180.23] INFO[0000] [dialer] Setup tunnel for host [180.153.180.33] INFO[0000] [dialer] Setup tunnel for host [180.153.180.11] INFO[0000] [dialer] Setup tunnel for host [180.153.180.34] INFO[0000] [etcd] Running snapshot save once on host [180.153.180.33] INFO[0000] Pulling image [rancher/rke-tools:v0.1.52] on host [180.153.180.33], try #1 INFO[0028] Image [rancher/rke-tools:v0.1.52] exists on host [180.153.180.33] INFO[0029] Starting container [etcd-snapshot-once] on host [180.153.180.33], try #1 INFO[0029] [etcd] Successfully started [etcd-snapshot-once] container on host [180.153.180.33] INFO[0029] Waiting for [etcd-snapshot-once] container to exit on host [180.153.180.33] INFO[0029] Container [etcd-snapshot-once] is still running on host [180.153.180.33] INFO[0030] Waiting for [etcd-snapshot-once] container to exit on host [180.153.180.33] INFO[0030] Removing container [etcd-snapshot-once] on host [180.153.180.33], try #1 INFO[0030] [etcd] Running snapshot save once on host [180.153.180.11] INFO[0030] Pulling image [rancher/rke-tools:v0.1.52] on host [180.153.180.11], try #1 INFO[0101] Image [rancher/rke-tools:v0.1.52] exists on host [180.153.180.11] INFO[0102] Starting container [etcd-snapshot-once] on host [180.153.180.11], try #1 INFO[0102] [etcd] Successfully started [etcd-snapshot-once] container on host [180.153.180.11] INFO[0102] Waiting for [etcd-snapshot-once] container to exit on host [180.153.180.11] INFO[0102] Container [etcd-snapshot-once] is still running on host [180.153.180.11] INFO[0103] Waiting for [etcd-snapshot-once] container to exit on host [180.153.180.11] INFO[0103] Removing container [etcd-snapshot-once] on host [180.153.180.11], try #1 INFO[0103] [etcd] Running snapshot save once on host [180.153.180.23] INFO[0104] Pulling image [rancher/rke-tools:v0.1.52] on host [180.153.180.23], try #1 INFO[0145] Image [rancher/rke-tools:v0.1.52] exists on host [180.153.180.23] INFO[0146] Starting container [etcd-snapshot-once] on host [180.153.180.23], try #1 INFO[0147] [etcd] Successfully started [etcd-snapshot-once] container on host [180.153.180.23] INFO[0147] Waiting for [etcd-snapshot-once] container to exit on host [180.153.180.23] INFO[0147] Container [etcd-snapshot-once] is still running on host [180.153.180.23] INFO[0148] Waiting for [etcd-snapshot-once] container to exit on host [180.153.180.23] INFO[0148] Removing container [etcd-snapshot-once] on host [180.153.180.23], try #1 INFO[0148] Finished saving/uploading snapshot [snapshot-name] on all etcd hosts robot@rke-test-master-01:~$ ls /opt/rke/etcd-snapshots/ snapshot-name.zip
# 清理网络接口 network_interface=`ls /sys/class/net` for net_inter in$network_interface; do if ! echo$net_inter | grep -qiE 'lo|docker0|eth*|ens*';then ip link delete $net_inter fi done
# 清理残留进程 port_list='80 443 6443 2376 2379 2380 8472 9099 10250 10254' for port in$port_list do pid=`netstat -atlnup|grep $port |awk '{print $7}'|awk -F '/''{print $1}'|grep -v -|sort -rnk2|uniq` if [[ -n $pid ]];then kill -9 $pid fi done
pro_pid=`ps -ef |grep -v grep |grep kube|awk '{print $2}'` if [[ -n $pro_pid ]];then kill -9 $pro_pid fi
1、FATA[0024] [workerPlane] Failed to bring up Worker Plane: [Failed to create [kube-proxy] container on host [180.153.180.11]: Failed to create Docker container [kube-proxy] on host [180.153.180.11]: <nil>]
3、restart coredns pods by:”kubctel delete pod coredns…. -n kube-system”
3、cordons-autoscaler 报错
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
robot@rke-test-master-01:~$ kubectl -n kube-system logs -f coredns-autoscaler-d8477bc7f-fdczp unknown flag: --nodelabels Usage of /cluster-proportional-autoscaler: --alsologtostderr[=false]: log to standard error as well as files --configmap="": ConfigMap containing our scaling parameters. --default-params=map[]: Default parameters(JSON format) for auto-scaling. Will create/re-create a ConfigMap with this default params if ConfigMap is not present. --log-backtrace-at=:0: when logging hits line file:N, emit a stack trace --log-dir="": If non-empty, write log files in this directory --logtostderr[=false]: log to standard error instead of files --namespace="": Namespace for all operations, fallback to the namespace of this autoscaler(through MY_POD_NAMESPACE env) if not specified. --poll-period-seconds=10: The time, in seconds, to check cluster status and perform autoscale. --stderrthreshold=2: logs at or above this threshold go to stderr --target="": Target to scale. In format: deployment/*, replicationcontroller/* or replicaset/* (not case sensitive). --v=0: log level for V logs --version[=false]: Print the version and exit. --vmodule=: comma-separated list of pattern=N settings for file-filtered logging