新建EC2
t2.medium
操作系統(tǒng)是 CentOS 7.5.1804 (x86_64) - with AWS_CLI_SSM and HVM - ami-0229f1a332c972082
安全組全開,能上網(wǎng)
從策劃到設(shè)計制作,每一步都追求做到細(xì)膩,制作可持續(xù)發(fā)展的企業(yè)網(wǎng)站。為客戶提供成都網(wǎng)站設(shè)計、網(wǎng)站制作、網(wǎng)站策劃、網(wǎng)頁設(shè)計、申請域名、虛擬空間、網(wǎng)絡(luò)營銷、VI設(shè)計、 網(wǎng)站改版、漏洞修補等服務(wù)。為客戶提供更好的一站式互聯(lián)網(wǎng)解決方案,以客戶的口碑塑造優(yōu)易品牌,攜手廣大客戶,共同發(fā)展進步。
系統(tǒng)初始化
yum install -y vim
yum install -y git
yum install -y wget
setenforce 0
sed -i 's/enforcing/disabled/' /etc/selinux/config
安裝docker
yum install -y docker
systemctl enable docker.service
systemctl start docker.service
配置yum源
cat > /etc/yum.repos.d/kubernetes.repo << EOF
[kubernetes]
name=Kubernetes
baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg https://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg
EOF
安裝kubeadm、kubelet、kubectl
yum install -y kubelet-1.13.3
yum install -y kubeadm-1.13.3
yum install -y kubectl-1.13.3
systemctl enable kubelet.service
systemctl start kubelet.service
說明:
--apiserver-advertise-address=10.44.41.236 是master的ip地址,
--service-cidr=10.96.0.0/16 是service的地址段,可自定義
--pod-network-cidr=10.244.0.0/16 是pod的地址段,可自定義**
初始化完成之后,會有如下提示,按照提示操作即可
Your Kubernetes master has initialized successfully!
To start using your cluster, you need to run the following as a regular user:
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
You should now deploy a pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
https://kubernetes.io/docs/concepts/cluster-administration/addons/
You can now join any number of machines by running the following on each node
as root:
kubeadm join 10.44.41.236:6443 --token 7dtiw9.7ytxxxxxx89x7tr --discovery-token-ca-cert-hash sha256:c2a0b41860xxxxxxff8dcb5d3b3a460
task 2 創(chuàng)建pod網(wǎng)絡(luò),先下載yml文件,再下載docker鏡像,然后把docker鏡像tag成與yml文件中一致,最后apply
wget https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
sudo docker pull akinlau/flannel-v0.11.0:v0.11.0
sudo docker images
sudo docker tag ff281650a721 quay.io/coreos/flannel:v0.11.0-amd64
kubectl apply -f kube-flannel.yml
task 3 執(zhí)行完命令之后在master上查看節(jié)點狀態(tài),node節(jié)點需要很久才能達(dá)到ready狀態(tài),因為下載flannel鏡像很慢,可以將master上的鏡像docker save保存,然后拷貝到node上執(zhí)行docker load導(dǎo)入
[centos@ip-10-44-41-236 ~]$ kubectl get nodes
NAME STATUS ROLES AGE VERSION
ip-10-44-41-236.cn-north-1.compute.internal Ready master 90m v1.13.3
ip-10-44-41-244.cn-north-1.compute.internal Ready <none> 27m v1.13.3
ip-10-44-41-43.cn-north-1.compute.internal Ready <none> 27m v1.13.3
當(dāng)前文章:在AWS云上搭建K8S集群
當(dāng)前鏈接:http://www.rwnh.cn/article12/jcjhdc.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供建站公司、外貿(mào)網(wǎng)站建設(shè)、網(wǎng)站設(shè)計、動態(tài)網(wǎng)站、靜態(tài)網(wǎng)站、App開發(fā)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)