1、修改 主机名
hostnamectl set-hostname minikube
2、关闭 selinux 及防火墙
sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config
systemctl stop firewalld && systemctl disable firewalld
3、禁用swap
# 临时
swapoff -a
# 永久,打开/etc/fstab注释掉swap那一行
sed -i 's/.*swap.*/#&/' /etc/fstab
4、修改网桥过滤及地址转发
cat <<EOF > /etc/sysctl.d/k8s.conf
vm.swappiness = 0
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
net.ipv4.ip_forward = 1
EOF
# 加载
modprobe br_netfilter
# 生效
sysctl -p /etc/sysctl.d/k8s.conf
5、修改Cgroup Driver
# 消除告警
cat <<EOF > /etc/docker/daemon.json
{
"registry-mirrors": ["http://hub-mirror.c.163.com"],
"exec-opts": ["native.cgroupdriver=systemd"]
}
EOF
# 重启生效
systemctl restart docker
6、安装 kubectl
curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.7.2/bin/linux/amd64/kubectl
chmod +x kubectl && mv kubectl /usr/local/bin/
7、安装 minikube
curl -Lo minikube https://storage.googleapis.com/minikube/releases/v1.7.2/minikube-linux-amd64
chmod +x minikube && mv minikube /usr/local/bin/
8、安装 conntrack 模块
yum install conntrack -y
9、安装 k8s
minikube start \
--image-repository registry.aliyuncs.com/google_containers \
--kubernetes-version v1.17.2 \
--vm-driver=none
10、查看状态
[root@minikube ~]# minikube status
minikube
type: Control Plane
host: Running
kubelet: Running
apiserver: Running
kubeconfig: Configured
11、查看 pod
[root@minikube ~]# kubectl get pods --all-namespaces
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system coredns-9d85f5447-xs24d 1/1 Running 0 80s
kube-system coredns-9d85f5447-zdfq9 1/1 Running 0 80s
kube-system etcd-minikube 1/1 Running 0 66s
kube-system kube-apiserver-minikube 1/1 Running 0 66s
kube-system kube-controller-manager-minikube 1/1 Running 0 66s
kube-system kube-proxy-j7vsk 1/1 Running 0 80s
kube-system kube-scheduler-minikube 1/1 Running 0 66s
kube-system storage-provisioner 1/1 Running 0 85s