云计算实训43——部署k8s基础环境、配置内核模块、基本组件安装

一、前期系统环境准备

1、关闭防火墙与selinux

[root@k8s-master ~]# systemctl stop firewalld

[root@k8s-master ~]# systemctl disable firewalld

Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.

[root@k8s-master ~]# setenforce 0

[root@k8s-master ~]# sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/sysconfig/selinux

[root@k8s-master ~]# sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config

2、配置主机映射

[root@k8s-master ~]# vim /etc/hosts

10.0.0.11 k8s-master

10.0.0.22 k8s-node01

10.0.0.33 k8s-node02
[root@k8s-master ~]# scp /etc/hosts [email protected]:/etc/hosts

[root@k8s-master ~]# scp /etc/hosts [email protected]:/etc/hosts

3、测试映射效果

[root@k8s-master ~]# ping k8s-node01

PING k8s-node01 (10.0.0.22) 56(84) bytes of data.

64 bytes from k8s-node01 (10.0.0.22): icmp_seq=1 ttl=64 time=0.346 ms

64 bytes from k8s-node01 (10.0.0.22): icmp_seq=2 ttl=64 time=0.265 ms
^C

--- k8s-node01 ping statistics ---

2 packets transmitted, 2 received, 0% packet loss, time 1000ms
rtt min/avg/max/mdev = 0.265/0.305/0.346/0.044 ms
[root@k8s-master ~]# ping k8s-node02

PING k8s-node02 (10.0.0.33) 56(84) bytes of data.

64 bytes from k8s-node02 (10.0.0.33): icmp_seq=1 ttl=64 time=0.306 ms

64 bytes from k8s-node02 (10.0.0.33): icmp_seq=2 ttl=64 time=0.193 ms
^C

--- k8s-node02 ping statistics ---

2 packets transmitted, 2 received, 0% packet loss, time 1000ms

4、配置主机间免密登录

[root@k8s-master ~]# ssh-keygen 

Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:pJNP7Nx9pi00P7w8nBNECxdAyHyKPnc6UNaLdXYs6b8 root@k8s-master
The key's randomart image is:

+---[RSA 2048]----+

|         o oo... |
|          + o o |
|       .. + + + |
|       =. + o B o|
|      +.So o * o |
|       *+.o.= o |
|        ++.+.=o+ |
|         o .*O .|
|           ...+E.|

+----[SHA256]-----+

[root@k8s-master ~]# ssh-copy-id [email protected]

/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: 

"/root/.ssh/id_rsa.pub"

/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to 
filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are 
prompted now it is to install the new keys
[email protected]'s password: 

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh '[email protected]'"

and check to make sure that only the key(s) you wanted were added.
[root@k8s-master ~]# ssh-copy-id [email protected]

5、配置yum源

[root@k8s-master ~]# cd /etc/yum.repos.d/
# docker软件源

[root@k8s-master yum.repos.d]# vim docker-ce.repo

[docker-ce-stable]

name=Docker CE Stable - $basearch
baseurl=https://mirrors.aliyun.com/dockerce/linux/centos/$releasever/$basearch/stable

enabled=1

gpgcheck=1

gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg
[docker-ce-stable-debuginfo]

name=Docker
 CE Stable - Debuginfo $basearch
baseurl=https://mirrors.aliyun.com/dockerce/linux/centos/$releasever/debug-$basearch/stable

enabled=0

gpgcheck=1

gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg
[docker-ce-stable-source]

name=Docker
 CE Stable - Sources

baseurl=https://mirrors.aliyun.com/dockerce/linux/centos/$releasever/source/stable

enabled=0

gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg
[docker-ce-test]

name=Docker CE Test - $basearch
baseurl=https://mirrors.aliyun.com/dockerce/linux/centos/$releasever/$basearch/test

enabled=0

gpgcheck=1

gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg
[docker-ce-test-debuginfo]

name=Docker
 CE Test - Debuginfo $basearch
baseurl=https://mirrors.aliyun.com/dockerce/linux/centos/$releasever/debug-$basearch/test

enabled=0

gpgcheck=1

gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg
[docker-ce-test-source]

name=Docker
 CE Test - Sources

baseurl=https://mirrors.aliyun.com/dockerce/linux/centos/$releasever/source/test

enabled=0

gpgcheck=1

gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg
[docker-ce-nightly]

name=Docker
 CE Nightly - $basearch
baseurl=https://mirrors.aliyun.com/dockerce/linux/centos/$releasever/$basearch/nightly

enabled=0

gpgcheck=1

gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg
[docker-ce-nightly-debuginfo]

name=Docker
 CE Nightly - Debuginfo $basearch
baseurl=https://mirrors.aliyun.com/dockerce/linux/centos/$releasever/debug-$basearch/nightly

enabled=0

gpgcheck=1

gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg
[docker-ce-nightly-source]

name=Docker
 CE Nightly - Sources

baseurl=https://mirrors.aliyun.com/dockerce/linux/centos/$releasever/source/nightly

enabled=0

gpgcheck=1

gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg

#
 K8S软件源

[root@k8s-master yum.repos.d]# vim kubernetes.repo 

[kubernetes]

name=Kubernetes

baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-
x86_64/

enabled=1

gpgcheck=0

repo_gpgcheck=0

gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg
[root@k8s-master yum.repos.d]# yum clean all && yum makecache

[root@k8s-master yum.repos.d]# scp docker-ce.repo 
[email protected]:/etc/yum.repos.d/
docker-ce.repo                                                   100% 2073   
  1.9MB/s   00:00    
[root@k8s-master yum.repos.d]# scp kubernetes.repo 
[email protected]:/etc/yum.repos.d/

kubernetes.repo                      
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值