[root@do ~]# yum install htop DigitalOcean Agent 85 kB/s | 3.3 kB 00:00 No match for argument: htop Error: Unable to find a match: htop [root@do ~]# yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm Last metadata expiration check: 0:00:33 ago on Sun 16 Aug 2020 02:29:32 AM UTC. epel-release-latest-8.noarch.rpm 14 kB/s | 22 kB 00:01 Dependencies resolved. ======================================================================================================= Package Architecture Version Repository Size ======================================================================================================= Installing: epel-release noarch 8-8.el8 @commandline 22 k
Total size: 22 k Installed size: 32 k Is this ok [y/N]: y Is this ok [y/N]: y Downloading Packages: Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Installing : epel-release-8-8.el8.noarch 1/1 Running scriptlet: epel-release-8-8.el8.noarch 1/1 Verifying : epel-release-8-8.el8.noarch 1/1
[root@py ~]# cat <<EOF > /etc/yum.repos.d/kubernetes.repo > [kubernetes] > name=Kubernetes > baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64 > enabled=1 > gpgcheck=1 > repo_gpgcheck=1 > gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg > EOF [root@py ~]# yum install -y kubectl Loaded plugins: fastestmirror Determining fastest mirrors epel/x86_64/metalink | 3.2 kB 00:00:00 * base: mirrors.neusoft.edu.cn * centos-sclo-rh: mirrors.neusoft.edu.cn * centos-sclo-sclo: mirrors.neusoft.edu.cn * epel: my.mirrors.thegigabit.com * extras: mirrors.neusoft.edu.cn * updates: mirrors.neusoft.edu.cn base | 3.6 kB 00:00:00 centos-sclo-rh | 3.0 kB 00:00:00 centos-sclo-sclo | 3.0 kB 00:00:00 docker-ce-stable | 3.5 kB 00:00:00 epel | 4.7 kB 00:00:00 extras | 2.9 kB 00:00:00 https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64/repodata/repomd.xml: [Errno 12] Timeout on https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64/repodata/repomd.xml: (28, 'Connection timed out after 30000 milliseconds') Trying other mirror. https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64/repodata/repomd.xml: [Errno 12] Timeout on https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64/repodata/repomd.xml: (28, 'Connection timed out after 30000 milliseconds') Trying other mirror. https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64/repodata/repomd.xml: [Errno 12] Timeout on https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64/repodata/repomd.xml: (28, 'Connection timed out after 30000 milliseconds') Trying other mirror. https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64/repodata/repomd.xml: [Errno 14] curl#35 - "TCP connection reset by peer" Trying other mirror.
One of the configured repositories failed (Kubernetes), and yum doesn't have enough cached data to continue. At this point the only safe thing yum can do is fail. There are a few ways to work "fix" this: 1. Contact the upstream for the repository and get them to fix the problem. 2. Reconfigure the baseurl/etc. for the repository, to point to a working upstream. This is most often useful if you are using a newer distribution release than is supported by the repository (and the packages for the previous distribution release still work). 3. Run the command with the repository temporarily disabled yum --disablerepo=kubernetes ... 4. Disable the repository permanently, so yum won't use it by default. Yum will then just ignore the repository until you permanently enable it again or use --enablerepo for temporary usage:
yum-config-manager --disable kubernetes or subscription-manager repos --disable=kubernetes
5. Configure the failing repository to be skipped, if it is unavailable. Note that yum will try to contact the repo. when it runs most commands, so will have to try and fail each time (and thus. yum will be be much slower). If it is a very temporary problem though, this is often a nice compromise:
failure: repodata/repomd.xml from kubernetes: [Errno 256] No more mirrors to try. https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64/repodata/repomd.xml: [Errno 12] Timeout on https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64/repodata/repomd.xml: (28, 'Connection timed out after 30000 milliseconds') https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64/repodata/repomd.xml: [Errno 12] Timeout on https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64/repodata/repomd.xml: (28, 'Connection timed out after 30000 milliseconds') https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64/repodata/repomd.xml: [Errno 12] Timeout on https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64/repodata/repomd.xml: (28, 'Connection timed out after 30000 milliseconds') https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64/repodata/repomd.xml: [Errno 14] curl#35 - "TCP connection reset by peer" [root@py ~]# export http_proxy="http://cn-py-dl-w9d:1081"
只好手动安装,v1.18.8
1 2 3 4 5
wget https://dl.k8s.io/v1.18.8/kubernetes-client-linux-amd64.tar.gz tar -zxvf kubernetes-client-linux-amd64.tar.gz cd kubernetes/client/bin chmod +x ./kubectl sudo mv ./kubectl /usr/local/bin/kubectl
[root@py ~]# doctl auth init Please authenticate doctl for use with your DigitalOcean account. You can generate a token in the control panel at https://cloud.digitalocean.com/account/api/tokens