Kubernetes deployment environment

Brief introduction

Kubernetes is an open source system, for automated deployment of the container application, scaling and management. It will form the container application grouped in logical units to facilitate management and discovery.
 
Mirroring group

Debian / Ubuntu

apt-get update && apt-get install -y apt-transport-https
curl https://mirrors.aliyun.com/kubernetes/apt/doc/apt-key.gpg | apt-key add -
cat <<EOF >/etc/apt/sources.list.d/kubernetes.list
deb https: // mirrors.aliyun.com/kubernetes/apt/ kubernetes great main- 
EOF  
apt-get update

CentOS / RHEL / Fedora

cat <<EOF > /etc/yum.repos.d/kubernetes.repo
[Kubernetes]
name = Kubernetes
baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/
enabled=1
gpgcheck=1
repo_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
setenforce 0

Centos for example to set up environment

1. Installation: in order

yum  install kubelet- 1.13 . 12 - 0 
yum  install kubectl- 1.13 . 12 - 0 
yum  install kubeadm- 1.13 . 12 - 0


2. Run the following command after installation, first check the image file required:

kubeadm config images list
-----------------------------
k8s.gcr.io/kube-apiserver:v1.13.12
k8s.gcr.io/kube-controller-manager:v1.13.12
k8s.gcr.io/kube-scheduler:v1.13.12
k8s.gcr.io/kube-proxy:v1.13.12
k8s.gcr.io/pause:3.1
k8s.gcr.io/etcd:3.2.24
k8s.gcr.io/coredns:1.2.6

3. introducing and image files corresponding to the configuration


docker load -i registry.aliyuncs.com.google_containers.kube-apiserver.tar
docker image ls
tag f07fae2c3e6a k8s.gcr.io/kube-apiserver:v1.13.12
docker load -i registry.aliyuncs.com.google_containers.kube-controller-manager.tar
docker image ls
docker tag 90fd4a237264 k8s.gcr.io/kube-controller-manager:v1.13.12
docker load -i registry.aliyuncs.com.google_containers.kube-scheduler.tar
docker image ls
docker tag 54f3185a42a5 k8s.gcr.io/kube-scheduler:v1.13.12
docker load -i registry.aliyuncs.com.google_containers.kube-proxy.tar
docker image ls
docker tag 4022daa30d3e k8s.gcr.io/kube-proxy:v1.13.12
docker load -i registry.aliyuncs.com.google_containers.pause.tar
docker image ls
docker tag da86e6ba6ca1 k8s.gcr.io/pause:3.1
docker load -i registry.aliyuncs.com.google_containers.etcd.tar
docker image ls
docker tag 3cab8e1b9802 k8s.gcr.io/etcd:3.2.24
docker load -i registry.aliyuncs.com.google_containers.coredns.tar
docker image ls
docker tag f59dcacceff4 k8s.gcr.io/coredns:1.2.6

4. After the import and modify mirroring, executive

The init = pod-network-cidr kubeadm 10244 . 0.0 / 16

5. If there is an error

 

6. Run the following command

 kubeadm init --pod-network-cidr=10.244.0.0/16 --ignore-preflight-errors=swap

7. After you do if an error occurs:

 

 8. The need to view the log:

--no-Page journalctl - XEU kubelet 
- or journalctl
--no-page -xeu kubelet | grep swap

 9. Check the configuration file:

cd  /usr/lib/systemd/system/kubelet.service.d
[root@localhost kubelet.service.d]# ls
10-kubeadm.conf

10. To find the configuration file environment configuration file path

EnvironmentGoogle nmentFile ro = - / etc / sysconfig / omelet

 

 11. Modify environment configuration file:

KUBELET_EXTRA_ARGS="--fail-swap-on=false"

 

 12.重启kubeadm

kubeadm reset

 13.再次执行

kubeadm init --pod-network-cidr=10.244.0.0/16 --ignore-preflight-errors=swap

 

 14.环境搭建成功

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 192.168.4.131:6443 --token ft7m0e.i9z5x43zbaa1yk55 --discovery-token-ca-cert-hash sha256:4b3a2b2a4a164ca270d4173169eda4ec707ad16653387e6960185dcb76832837

 

 

Guess you like

Origin www.cnblogs.com/mingfan/p/12081699.html
Recommended