>>> a = 'cheesezh' >>> b = 'cheesezh' >>> a == b True
is 也被叫做同一性运算符,这个运算符比较判断的是对象间的唯一身份标识,也就是id是否相同。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
>>> x = y = [4,5,6] >>> z = [4,5,6] >>> x == y True >>> x == z True >>> x is y True >>> x is z False >>> >>> printid(x) 3075326572 >>> printid(y) 3075326572 >>> printid(z) 3075328140
可以明显的看到前 3 个比较都是 True, 最后一个是 False。
使用 id() 方法查看 x, y, z 的对象ID就明白了。
我在这里使用的是数组,其实,当它们是 tuple, list, dict 或者 set 时也一样。
不过,当类型是 int 或者 string 时,它们的对象ID都会一样,
1 2 3 4 5 6 7 8
>>> a = 1 >>> b = 1 >>> a is b True >>> a = "asd" >>> b = "asd" >>> a is b True
[root@k8s-master-1 ~]# swapoff -a [root@k8s-master-1 ~]# cat /etc/fstab
# # /etc/fstab # Created by anaconda on Mon Mar 26 20:43:49 2018 # # Accessible filesystems, by reference, are maintained under '/dev/disk' # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info # /dev/mapper/centos-root / xfs defaults 0 0 UUID=848d5a8b-0ee9-481f-b1ff-833fb35cfd03 /boot xfs defaults 0 0 /dev/mapper/centos-home /home xfs defaults 0 0 #/dev/mapper/centos-swap swap swap defaults 0 0
[root@k8s-master-1 ~]# cat /etc/yum.repos.d/CentOS-Base.repo # CentOS-Base.repo # # The mirror system uses the connecting IP address of the client and the # update status of each mirror to pick mirrors that are updated to and # geographically close to the client. You should use this for CentOS updates # unless you are manually picking other mirrors. # # If the mirrorlist= does not work for you, as a fall back you can try the # remarked out baseurl= line instead. # # [base] name=CentOS-$releasever - Base - 163.com #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os baseurl=http://mirrors.163.com/centos/$releasever/os/$basearch/ gpgcheck=1 gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
... Your Kubernetes control-plane has initialized successfully! ... Then you can join any number of worker nodes by running the following on each as root: