当前位置:网站首页>Complete and detailed installation steps for kubeneter version 1.7
Complete and detailed installation steps for kubeneter version 1.7
2022-06-21 14:34:00 【Internet Walker】
| Use kubeadm install kuberneters1.17.3 | |
| # System environment preparation | |
| Use 3 platform centos7.2 operating system , The roles of the machine are master,worknode,worknode | |
| 1、 Set host name | |
| hostnamectl set-hostname master | |
| 2、 edit /etc/hosts | |
| cat <<EOF >>/etc/hosts | |
| 10.10.10.1 master | |
| 10.10.10.2 node1 | |
| 10.10.10.3 node2 | |
| EOF | |
| 3、 Turn off firewall , No exchange swap | |
| systemctl stop firewalld | |
| systemctl disable firewalld | |
| setenforce 0 | |
| sed -i "s/^SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config | |
| swapoff -a | |
| sed -i 's/.*swap.*/#&/' /etc/fstab | |
| The above operations are generally not required for virtual machines , Swap memory is turned off by default , Turn off firewall . | |
| 4、 Configure kernel parameters ,IPv4 Flow to iptables On the chain | |
| cat > /etc/sysctl.d/k8s.conf <<EOF | |
| net.bridge.bridge-nf-call-ip6tables = 1 | |
| net.bridge.bridge-nf-call-iptables = 1 | |
| net.ipv4.ip_forward = 1 | |
| EOF | |
| sysctl --system | |
| If you encounter /proc/sys/net/bridge/bridge-nf-call-iptables contents are not set to 1 | |
| Solution : | |
| echo 1 > /proc/sys/net/bridge/bridge-nf-call-iptables | |
| echo 1 > /proc/sys/net/bridge/bridge-nf-call-ip6tables | |
| 5、 Add domestic Kubernetes Source | |
| 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 | |
| 6、 add to docker Source | |
| cat <<EOF > /etc/yum.repos.d/docker.repo | |
| [docker-ce-stable] | |
| name=Docker CE Stable - $basearch | |
| baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/7/$basearch/stable | |
| enabled=1 | |
| gpgcheck=1 | |
| gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg | |
| EOF | |
| k8s install | |
| 7、 Each machine is equipped with | |
| yum install kubelet kubeadm kubectl | |
| systemctl enable kubelet | |
| # k8s install | |
| 1、 Deploy master node | |
| stay master Node initialization | |
| kubeadm init --kubernetes-version=1.17.3 --apiserver-advertise-address=10.192.126.118 --image-repository registry.aliyuncs.com/google_containers --service-cidr=10.1.0.0/16 --pod-network-cidr=10.244.0.0/16 | |
| If appear | |
| detected "cgroupfs" as the Docker cgroup driver. The recommended driver is "systemd" | |
| terms of settlement : | |
| Modify or create /etc/docker/daemon.json, Add the following : | |
| { | |
| "exec-opts": ["native.cgroupdriver=systemd"] | |
| } | |
| [ERROR DirAvailable--var-lib-etcd]: /var/lib/etcd is not empty | |
| terms of settlement : | |
| rm -rf /var/lib/etcd | |
| After successful installation, the following information should be kept in mind | |
| Your Kubernetes control-plane 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/ | |
| Then you can join any number of worker nodes by running the following on each as root: | |
| kubeadm join 10.192.126.118:6443 --token cjcepg.zlpbj2advlh0k5e5 \ | |
| --discovery-token-ca-cert-hash sha256:825f8a4ebe2da9187cde8351805df71e099a81c2a9f9d33f7456eb3fbf4cae0c | |
| If you encounter kubectl get nodes And so on error: the server doesn't have a resource type "nodes" | |
| This is because of the permission problem , Need to use sudo, Now it's root Account number also needs sudo function , You can try to run sudo -s | |
| 1、 Use... After creation kubectl get pods --all-namespaces see pod Health of , In practice, I encountered | |
| kube-system coredns-9d85f5447-mk9cq 0/1 ContainerCreating 0 12m | |
| kube-system coredns-9d85f5447-wjpk7 0/1 ContainerCreating 0 12m | |
| Yes, it is kubectl describe pod coredns-9d85f5447-mk9cq -n kube-system see pod Information , The main mistake is | |
| network: error getting ClusterInformation,https://10.43.0.1:443/apis/crd.projectcalico.org/v1/clusterinformations/default | |
| This is generally an analysis netowrkplugin, Profile path /etc/cni/net.d, My situation is because of the previous machine CNI The plug-in doesn't have | |
| Clean up , The current selection is canal, So you need to delete 10-calico.conflist, modify 10-canal.yaml Content . | |
| Revision reference https://docs.projectcalico.org/reference/cni-plugin/configuration | |
| 2、 Log view journalctl -f -u kubelet |grep -i error -C 500 | |
| # k8s Cluster uninstall | |
| kubeadm reset -f | |
| modprobe -r ipip | |
| lsmod | |
| rm -rf ~/.kube/ | |
| rm -rf /etc/kubernetes/ | |
| rm -rf /etc/systemd/system/kubelet.service.d | |
| rm -rf /etc/systemd/system/kubelet.service | |
| rm -rf /usr/bin/kube* | |
| rm -rf /etc/cni | |
| rm -rf /opt/cni | |
| rm -rf /var/lib/etcd | |
| rm -rf /var/etcd | |
| ifconfig flannel.1 down | |
| ip link delete flannel.1 | |
| yum clean all | |
| Use the configuration file for cluster initialization | |
| 1、kubeadm config print init-defaults ClusterConfiguration >kubeadm-config.conf | |
| 2、 modify kubeadm-config.conf | |
| kubeadm init --config kubeadm-config.yaml | |
| apiVersion: kubeadm.k8s.io/v1beta2 | |
| bootstrapTokens: | |
| - groups: | |
| - system:bootstrappers:kubeadm:default-node-token | |
| token: abcdef.0123456789abcdef | |
| ttl: 24h0m0s | |
| usages: | |
| - signing | |
| - authentication | |
| kind: InitConfiguration | |
| localAPIEndpoint: | |
| advertiseAddress: 10.192.126.118 | |
| bindPort: 6443 | |
| nodeRegistration: | |
| criSocket: /var/run/dockershim.sock | |
| name: test4.leapmotor.com | |
| taints: | |
| - effect: NoSchedule | |
| key: node-role.kubernetes.io/master | |
| --- | |
| apiServer: | |
| timeoutForControlPlane: 4m0s | |
| apiVersion: kubeadm.k8s.io/v1beta2 | |
| certificatesDir: /etc/kubernetes/pki | |
| clusterName: kubernetes | |
| controllerManager: {} | |
| dns: | |
| type: CoreDNS | |
| etcd: | |
| local: | |
| dataDir: /var/lib/etcd | |
| imageRepository: registry.aliyuncs.com/google_containers | |
| kind: ClusterConfiguration | |
| kubernetesVersion: v1.17.0 | |
| networking: | |
| dnsDomain: cluster.local | |
| serviceSubnet: 10.96.0.0/12 | |
| podSubnet: 10.244.0.0/16 | |
| scheduler: {} | |
| 3、 modify kubelet Start parameter of | |
| vim /usr/lib/systemd/system/kubelet.service.d/10-kubeadm.conf | |
| ExecStart=/usr/bin/kubelet --logtostderr=false --log-dir=/var/log/kubernetes( Make sure /var/log/kubernetes The path is correct ) | |
| systemctl daemon-reload |
边栏推荐
- Solution of difficult and miscellaneous problems in MVN packaging
- PCA dimension reduction application of OpenCV (I)
- Native JS implements login function, and local cookies save login information -- [call Netease cloud API interface] - super detailed explanation
- Explain the design idea and capacity expansion mechanism of ThreadLocal in detail
- 2021-2022 recall of the final exam questions of non relational database of Shandong University
- Usage of SED (replacement, deletion of text content, etc.)
- JS written test question: asynchronous
- Define structure dynamically when macro is defined
- STM32F0-DAY1
- T32 custom menu bar
猜你喜欢

CSDN's test teacher teaches JMeter to generate stress test reports

Sliding validation tool class
![[how to install MySQL 8.0 to a non system disk] [how to create a new connection with Navicat and save it to a non system disk] and [uninstall MySQL 8.0]](/img/e4/895cc829e34692a069923e226deb11.jpg)
[how to install MySQL 8.0 to a non system disk] [how to create a new connection with Navicat and save it to a non system disk] and [uninstall MySQL 8.0]

Usage of SED (replacement, deletion of text content, etc.)

The code remotely calls aria2 to download URL resources or BT seeds

Imitation B station web, app, background

Explain the design idea and capacity expansion mechanism of ThreadLocal in detail

Simplified crud using code generation
![[font multi line display ellipsis] and [dialog box] implementation ----- case explanation, executable code](/img/f8/9cfaafd0c013823e801beb9d4a946a.jpg)
[font multi line display ellipsis] and [dialog box] implementation ----- case explanation, executable code

In the autumn of 2022, from being rejected to sp+, talk about the experience and harvest of YK bacteria in 2021
随机推荐
What are the log files in MySQL?
Reptile essential_ regular expression
Reptile Foundation_ Requests Library
Flex layout --- detailed explanation [Blue Bridge Cup classic dice layout]
[test process and theory - Test Technology System]
JS written test question: asynchronous
!!** The test is valid * *:vscode "the terminal will be reused by the task, press any key to close" /vscode the terminal runs NPM to pop up the select program dialog box / try a new cross platform Pow
Read distributed consistency protocols 2pc and 3pc
Chapter 4 - network layer
Why is epoll efficient?
Two of my essays
Office operation sorting notes
Write a code hot deployment
[font multi line display ellipsis] and [dialog box] implementation ----- case explanation, executable code
Vscade, open a folder or workspace... (file - > open folder) solution
Design interface automation test cases by hand: establish database instances and test case tables
NPM package management configuration file [package.json and node\u modules configuration details and how to develop their own packages and publish them on NPM]
HSV color model and color component range in opencv
Qt-6-file IO
JS interview question: regular expression, to be updated