您好,登录后才能下订单哦!
这篇文章将为大家详细讲解有关k8s如何安装,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。
允许 iptables 检查桥接流量 https://kubernetes.io/zh/docs/setup/production-environment/tools/kubeadm/install-kubeadm/ https://askubuntu.com/questions/783017/bash-proc-sys-net-ipv4-ip-forward-permission-denied
cat <<EOF | sudo tee /etc/modules-load.d/k8s.conf br_netfilter EOF sudo yum install bridge-utils -y sudo echo br_netfilter > /etc/modules-load.d/br_netfilter.conf cat <<EOF | sudo tee /etc/sysctl.d/k8s.conf net.bridge.bridge-nf-call-ip6tables = 1 net.bridge.bridge-nf-call-iptables = 1 EOF echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward sudo sysctl --system
安装 runtime https://kubernetes.io/zh/docs/setup/production-environment/container-runtimes/
cat <<EOF | sudo tee /etc/modules-load.d/containerd.conf overlay br_netfilter EOF sudo modprobe overlay sudo modprobe br_netfilter # 设置必需的 sysctl 参数,这些参数在重新启动后仍然存在。 cat <<EOF | sudo tee /etc/sysctl.d/99-kubernetes-cri.conf net.bridge.bridge-nf-call-iptables = 1 net.ipv4.ip_forward = 1 net.bridge.bridge-nf-call-ip6tables = 1 EOF # Apply sysctl params without reboot sudo sysctl --system sudo apt-get update && sudo apt-get install -y containerd sudo mkdir -p /etc/containerd sudo containerd config default | sudo tee /etc/containerd/config.toml sudo systemctl restart containerd
【ubuntu】安装 kubeadm、kubelet 和 kubectl https://kubernetes.io/zh/docs/setup/production-environment/tools/kubeadm/install-kubeadm/
sudo apt-get update && sudo apt-get install -y apt-transport-https curl curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - cat <<EOF | sudo tee /etc/apt/sources.list.d/kubernetes.list deb https://apt.kubernetes.io/ kubernetes-xenial main EOF sudo apt-get update sudo apt-get install -y kubelet kubeadm kubectl sudo apt-mark hold kubelet kubeadm kubectl sudo systemctl daemon-reload sudo systemctl restart kubelet
【centos】安装 kubeadm、kubelet 和 kubectl
cat <<EOF | sudo tee /etc/yum.repos.d/kubernetes.repo [kubernetes] name=Kubernetes baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-\$basearch enabled=1 gpgcheck=1 repo_gpgcheck=1 gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg exclude=kubelet kubeadm kubectl EOF # 将 SELinux 设置为 permissive 模式(相当于将其禁用) setenforce 0 sed -i 's/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/config yum install -y kubelet kubeadm kubectl --disableexcludes=kubernetes systemctl enable --now kubelet
关闭swap https://stackoverflow.com/questions/47094861/error-while-executing-and-initializing-kubeadm
sudo swapoff -a
安装etcd https://etcd.io/docs/current/dl-build/
git clone https://github.com/etcd-io/etcd.git cd etcd yum install golang ./build.sh ln -s /root/etcd/bin/etcd /usr/local/bin/etcd
初始化控制平面节点 https://kubernetes.io/zh/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/
kubeadm init --pod-network-cidr 10.244.0.0/16 export KUBECONFIG=/etc/kubernetes/admin.conf
安装 Pod 网络附加组件 https://stackoverflow.com/questions/49112336/container-runtime-network-not-ready-cni-config-uninitialized https://www.jianshu.com/p/9819a9f5dda0
kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/2140ac876ef134e0ed5af15c65e414cf26827915/Documentation/kube-flannel.yml cat <<EOF | sudo tee /run/flannel/subnet.env FLANNEL_NETWORK=10.244.0.0/16 FLANNEL_SUBNET=10.244.0.1/24 FLANNEL_MTU=1450 FLANNEL_IPMASQ=true EOF
控制平面节点隔离 https://kubernetes.io/zh/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/
kubectl taint nodes --all node-role.kubernetes.io/master-
发布应用 https://kubernetes.io/zh/docs/tutorials/kubernetes-basics/deploy-app/deploy-interactive/ https://kubernetes.io/zh/docs/tutorials/kubernetes-basics/expose/expose-interactive/
kubectl create deployment kubernetes-bootcamp --image=gcr.io/google-samples/kubernetes-bootcamp:v1 kubectl expose deployment/kubernetes-bootcamp --type="NodePort" --port 8080
关于“k8s如何安装”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,使各位可以学到更多知识,如果觉得文章不错,请把它分享出去让更多的人看到。
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。