如何在CentOS7上部署Kubernetes集群?
systemctl stop firewalld
systemctl disable firewalld
# 禁用SELINUX
setenforce 0
sed -i --follow-symlinks 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/sysconfig/selinux
# 关闭swap
swapoff -a
或永久关闭
vi /etc/fstab
注释掉下面这句
# /dev/mapper/centos-swap swap swap defaults 0 0
#设置br_netfilter
modprobe br_netfilter
echo '1' > /proc/sys/net/bridge/bridge-nf-call-iptables
#设置iptables等
echo '1' > /proc/sys/net/bridge/bridge-nf-call-iptables
sudo bash -c 'echo 1 > /proc/sys/net/ipv4/ip_forward'
#添加yum源
vi /etc/yum.repos.d/kubernetes.repo
添加内容如下-建议从本文参考网址拷贝如下内容,防止格式差异(本文第四行):
谷歌:
[kubernetes]
name=Kubernetes
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64
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
```
阿里云:
### 然后安装
```
yum install -y kubelet kubeadm kubectl
附录:
卸载
yum remove kubelet kubeadm kubectl
安装指定版本
yum install -y kubelet-1.13.5-0.x86_64
yum install -y kubectl-1.13.5-0.x86_64
yum install -y kubeadm-1.13.5-0.x86_64
```
### 官网参考
https://kubernetes.io/docs/setup/independent/create-cluster-kubeadm/
###
### 常用命令
```
kubectl cluster-info
kubectl get pods --all-namespaces
sudo journalctl -u kubelet --all | tail
kubectl logs 99a04cab33e1 -n=istio-system
kubectl --kubeconfig=/home/linux/.kube/kubeconfig.yaml get svc -n ingress-nginx
watch kubectl get pods --all-namespaces
kubectl taint nodes --all node-role.kubernetes.io/master-
Copyright © 广州京杭网络科技有限公司 2005-2024 版权所有 粤ICP备16019765号
广州京杭网络科技有限公司 版权所有