安装单机版kubernetes
申明:本文参考博客安装单机版kubernetes_帅凡x的博客-CSDN博客安装单机版kuberneteshttps://blog.csdn.net/qq_42244644/article/details/124406032准备系统:vmware下的centos7虚拟机安装步骤:1.首先关闭防火墙和selinux修改文件vi /etc/selinux/config2. 禁用swap3
申明:本文参考博客安装单机版kubernetes_帅凡x的博客-CSDN博客安装单机版kuberneteshttps://blog.csdn.net/qq_42244644/article/details/124406032
准备系统:vmware下的centos7虚拟机
安装步骤:
1.首先关闭防火墙和selinux
修改文件vi /etc/selinux/config
2. 禁用swap
3. 修改内核参数和模块
修改文件vi /etc/sysctl.d/k8s.conf
执行命令
4. 安装docker
yum -y install yum-utils device-mapper-persistent-data lvm2
yum-config-manager -y --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum -y install docker-ce-18.06.3.ce-3.el7 docker-ce-cli-18.06.3.ce-3.el7 containerd.io
systemctl start docker
systemctl enable docker
安装完执行下docker version
5. 安装kubernates组件
修改文件vi /etc/yum.repos.d/kubernetes.repo
执行命令
yum -y install kubelet-1.13* kubeadm-1.13* kubectl-1.13*
systemctl start kubelet
systemctl enable kubelet
6. 下载kubernetes镜像
docker pull mirrorgooglecontainers/kube-apiserver:v1.13.3
docker pull mirrorgooglecontainers/kube-controller-manager:v1.13.3
docker pull mirrorgooglecontainers/kube-scheduler:v1.13.3
docker pull mirrorgooglecontainers/kube-proxy:v1.13.3
docker pull mirrorgooglecontainers/pause:3.1
docker pull mirrorgooglecontainers/etcd:3.2.24
docker pull coredns/coredns:1.2.6
# 打标签
docker tag mirrorgooglecontainers/kube-apiserver:v1.13.3 k8s.gcr.io/kube-apiserver:v1.13.3
docker tag mirrorgooglecontainers/kube-controller-manager:v1.13.3 k8s.gcr.io/kube-controller-manager:v1.13.3
docker tag mirrorgooglecontainers/kube-scheduler:v1.13.3 k8s.gcr.io/kube-scheduler:v1.13.3
docker tag mirrorgooglecontainers/kube-proxy:v1.13.3 k8s.gcr.io/kube-proxy:v1.13.3
docker tag mirrorgooglecontainers/pause:3.1 k8s.gcr.io/pause:3.1
docker tag mirrorgooglecontainers/etcd:3.2.24 k8s.gcr.io/etcd:3.2.24
docker tag coredns/coredns:1.2.6 k8s.gcr.io/coredns:1.2.6
7. 初始化
kubeadm init --kubernetes-version=v1.13.3 --pod-network-cidr=10.100.0.0/16
接下来根据提示做如下操作
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
kubectl apply -f https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d '\n')
成功后执行如下命令看是否成功
kubectl get pods --all-namespaces
至此安装完成
更多推荐
所有评论(0)