Initialize the Kubernetes Basic Environment Configuration on CentOS 8.3

机器克隆后 IP修改,使Xshell连接上

[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens32
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static ### 配置静态IP,防止修改
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens32
UUID=fd9a1d20-b069-4c58-9607-40ae54cae5b6
DEVICE=ens32
ONBOOT=yes           ### 是否开机时就启用
IPADDR=192.168.80.21 ### 修改ip地址
PREFIX=24
GATEWAY=192.168.80.2 # 修改网关地址
DNS1=114.114.114.114 # DSN配置上,不然使用域名会找不到的
DNS2=8.8.8.8
IPV6_PRIVACY=no
PEERDNS=no

重启网卡,并测试好不好使

[root@localhost ~]$ sudo nmcli c reload ens32
[root@localhost ~]$ sudo nmcli c up ens32
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/6)

### 重启完后测试
[root@localhost ~]$ ping 114.114.114.114
PING 114.114.114.114 (114.114.114.114) 56(84) bytes of data.

64 bytes from 114.114.114.114: icmp_seq=1 ttl=128 time=33.2 ms
64 bytes from 114.114.114.114: icmp_seq=2 ttl=128 time=51.9 ms
64 bytes from 114.114.114.114: icmp_seq=3 ttl=128 time=276 ms
^C
2 packets transmitted, 2 received, 0% packet loss, time 4ms
rtt min/avg/max/mdev = 24.005/25.233/26.462/1.238 ms
[root@kube-master01 yum.repos.d]# yum -y install epel-release
CentOS-8 - AppStream                                                                        43  B/s |  38  B     00:00
Error: Failed to download metadata for repo 'AppStream': Cannot prepare internal mirrorlist: No URLs in mirrorlist

可以在/etc/yum.repos中更新repos.d使用vault.centos.org代替mirror.centos.org

修改下面两个文件

cd /etc/yum.repos.d
vi CentOS-Linux-BaseOS.repo
vi CentOS-Linux-AppStream.repo

CentOS-Linux-BaseOS.repo 的内容修改为

[Baseos]
name=CentOS Linux $releasever - BaseOS
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=BaseOS&infra=$infra
#baseurl=http://mirror.centos.org/$contentdir/$releasever/BaseOS/$basearch/os/
baseurl=https://vault.centos.org/centos/$releasever/BaseOS/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial

CentOS-Linux-AppStream.repo 的内容修改为

[appstream]
name=CentOS Linux $releasever - AppStream
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=AppStream&infra=$infra
#baseurl=http://mirror.centos.org/$contentdir/$releasever/AppStream/$basearch/os/
baseurl=https://vault.centos.org/centos/$releasever/AppStream/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial

再执行

yum -y install epel-release

Original: https://www.cnblogs.com/huaxiayuyi/p/16795089.html
Author: 娇小赤雅
Title: Initialize the Kubernetes Basic Environment Configuration on CentOS 8.3



相关阅读

Title: python/numpy辨析–reshape和resize的区别?有哪些函数可以改变数组的形状?

  • ndarray.flat
  • ndarray.flatten(order)
  • ndarray.ravel(order)
  • ndarray.resize(newshape,order)和numpy.resize(ndarray,newshape,order)
  • ndarray.reshape(newshape,order)和numpy.reshape(ndarray,newshape,order)

以下都是基于python3.8,numpy1.22。

1.resize才可以改变形状的大小,reshape不能改变形状的大小。

这里指的形状大小指各个维度尺寸的相乘,比如原形状是(3,4),大小是12,如果用reshape()新形状可以是(1,12),(2,6),但不能是(6,4)。

如果使用ndarray.resize扩展形状大小,空白部分用第一个元素补全,如果使用numpy.resize()扩展形状大小,空白部分依次用原数据的从头到尾的顺序填充。

import numpy as np
arr = np.arange(12).reshape(3,4)

print(np.reshape(arr,(6,8)))
# ValueError: cannot reshape array of size 12 into shape (6,8)

print(np.resize(arr,(6,8)))
#  输出为▼▼▼
# [[ 0  1  2  3  4  5  6  7]
#  [ 8  9 10 11  0  1  2  3]
#  [ 4  5  6  7  8  9 10 11]
#  [ 0  1  2  3  4  5  6  7]
#  [ 8  9 10 11  0  1  2  3]
#  [ 4  5  6  7  8  9 10 11]]

# ------------以上是调用numpy函数,以下是调用ndarray属性-------------

import numpy as np
arr = np.arange(12).reshape(3,4)

arr.resize(4,3)
print(arr)
#  输出为▼▼▼
# [[ 0  1  2]
#  [ 3  4  5]
#  [ 6  7  8]
#  [ 9 10 11]]
arr1 = arr.copy()
arr1.resize(8, 3)
print(arr1)
#  输出为▼▼▼
# [[ 0  1  2]
#  [ 3  4  5]
#  [ 6  7  8]
#  [ 9 10 11]
#  [ 0  0  0]
#  [ 0  0  0]
#  [ 0  0  0]
#  [ 0  0  0]]

print(arr.reshape(6,8))
# ValueError: cannot reshape array of size 12 into shape (6,8)

注意:对于ndarray.resize,如果涉及到改变形状大小,可能会报错【ValueError: cannot resize this array: it does not own its data】,这时把原数组进行一个拷贝(至少是浅拷贝,不能是引用),然后对拷贝的那一份进行ndarray.resize,就可以避免该错误了。

  • ndarray.resize(newshape,order)和numpy.resize(ndarray,newshape,order)
  • ndarray.reshape(newshape,order)和numpy.reshape(ndarray,newshape,order)

2.不管是ndarray.reshape还是numpy.reshape,都无法直接改变原数组,但是都可以通过返回值得到改变形状后的数组;只有ndarray.resize才能直接改变原数组,而对于numpy.resize也需要通过返回值得到改变形状后的数组;或许正是因为只有ndarray.resize才能直接改变原数组,所以也只有这一种用法没有返回值。

import numpy as np

arr = np.arange(12).reshape(2, 6)

print(np.resize(arr, (3, 4)))
# [[ 0  1  2  3]
#  [ 4  5  6  7]
#  [ 8  9 10 11]]
print(arr)
# [[ 0  1  2  3  4  5]
#  [ 6  7  8  9 10 11]]

print(np.reshape(arr, (4, 3)))
# [[ 0  1  2]
#  [ 3  4  5]
#  [ 6  7  8]
#  [ 9 10 11]]
print(arr)
# [[ 0  1  2  3  4  5]
#  [ 6  7  8  9 10 11]]

print(arr.resize(3, 4))
# 输出None
print(arr)
# [[ 0  1  2  3]
#  [ 4  5  6  7]
#  [ 8  9 10 11]]

print(arr.reshape(4, 3))
# [[ 0  1  2]
#  [ 3  4  5]
#  [ 6  7  8]
#  [ 9 10 11]]
print(arr)
# [[ 0  1  2  3]
#  [ 4  5  6  7]
#  [ 8  9 10 11]]

print(np.arange(12).resize(2, 6))
# 输出None

Original: https://blog.csdn.net/PSpiritV/article/details/123208806
Author: 键盘即钢琴
Title: python/numpy辨析–reshape和resize的区别?有哪些函数可以改变数组的形状?

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/363441/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

最近整理资源【免费获取】:   👉 程序员最新必读书单  | 👏 互联网各方向面试题下载 | ✌️计算机核心资源汇总