How to configure kubeadm-install-kubernetes
This article mainly introduces the relevant knowledge of how to configure kubeadm-install-kubernetes, the content is detailed and easy to understand, the operation is simple and fast, and has a certain reference value. I believe you will gain something after reading this article on how to configure kubeadm-install-kubernetes. Let's take a look at it.
-yum repo
Baseurl= http://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/
Baseurl= http://mirrors.aliyun.com/docker-ce/linux/centos/7/x86_64/stable/
Baseurl= http://mirrors.aliyun.com/epel/7/x86_64
Baseurl= http://mirrors.aliyun.com/centos/7/extras/x86_64/
# 1. Configure system-related parameters
Cat / etc/yum.repos.d/10.245.254.93_linux_soft_epel_7.repo
# 3. Install kubeadm & docker
# yum-y install docker-ce kubeadm kubelet kubectl
Yum-y install docker-ce-18.06.3.ce-3.el7 kubeadm-1.14.3 kubelet-1.14.3 kubectl-1.14.3
Systemctl enable docker kubelet
Sed-I "17a\ ExecStartPost=/usr/sbin/iptables-P FORWARD ACCEPT" / usr/lib/systemd/system/docker.service
# https://kubernetes.io/docs/setup/cri
Mkdir / etc/docker / etc/systemd/system/docker.service.d
Cat > / etc/hosts
Echo '10.247.15.75 node01' > > / etc/hosts
Echo '10.247.15.89 node02' > > / etc/hosts
Echo '10.247.15.92 node03' > > / etc/hosts
# 5.-for Master site install
Kubeadm init\
-- kubernetes-version=v1.14.3\
-- apiserver-advertise-address=10.247.15.75\
-- pod-network-cidr=10.244.0.0/16\
-- service-cidr=192.168.0.0/16\
-- image-repository=ispcdocker.com/k8s
# https://github.com/coreos/flannel
# https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
Curl http://10.245.254.93/linux/soft/docker/kubernetes/kube-flannel-v0.11.0.yml > / tmp/flannel.yaml
Sed-I '212 sed / tmp/flannel.yaml
Sed-I "s#quay.io/coreos#ispcdocker.com/k8s#g" / tmp/flannel.yaml
Kubectl-- kubeconfig=/etc/kubernetes/admin.conf apply-f / tmp/flannel.yaml
Mkdir-p $HOME/.kube
Cp-I / etc/kubernetes/admin.conf $HOME/.kube/config
Chown $(id-u): $(id-g) $HOME/.kube/config
Kubectl get nodes
Kubectl get cs
Kubectl get pods-- all-namespaces-o wide # to see which machine dashboard is assigned to by K8s
Kubectl get services-- all-namespaces # View the IP within the cluster of dashboard
Kubectl get services-n kube-system
Kubectl-n kube-system get all
Kubectl-n kube-system top pods
# 6.-for Minion site
# kubeadm token create-- print-join-command | sed's VIP ${LOCAL_IP} / ${VIP} / g'
Kubeadm join 10.247.15.75 6443-- token 662w0d.roh3btd0g6cbxc5y\
-- discovery-token-ca-cert-hash sha256:b700f04ead542060189e02581f5463d50b4f003c78a8c118d6e6a14884e09d83
# 7.-for Dashboard
# https://github.com/kubernetes/dashboard
# https://github.com/kubernetes-retired/heapster/tree/master/deploy/kube-config/influxdb
# https://kubernetes.io/docs/tasks/access-application-cluster/web-ui-dashboard/
# https://docs.giantswarm.io/guides/install-kubernetes-dashboard/
# https://stackoverflow.com/questions/46664104/how-to-sign-in-kubernetes-dashboard
# https://github.com/kubernetes/dashboard/wiki/Accessing-Dashboard---1.7.X-and-above
# https://github.com/kubernetes/dashboard/wiki/Certificate-management
# https://sunwfrk.com/k8s-dashboard-installation/
# https://docs.aws.amazon.com/eks/latest/userguide/dashboard-tutorial.html
# https://github.com/kubernetes-retired/heapster
# https://github.com/kubernetes-incubator/metrics-server
# docker pull registry.cn-hangzhou.aliyuncs.com/google_containers/metrics-server-amd64:v0.3.3
# 7.1 install metrics-server
# https://blog.codewithdan.com/enabling-metrics-server-for-kubernetes-on-docker-desktop/
# https://blog.csdn.net/oyym_mv/article/details/87166639
Https://blog.csdn.net/zyl290760647/article/details/83041991
Wget http://10.245.254.93/linux/soft/docker/kubernetes/metrics/metrics-server-0.3.3.tar.gz
Tar zxpf metrics-server-0.3.3.tar.gz
Cd metrics-server-0.3.3
Sed-I'32 deploy/1.8+/metrics-server-deployment.yaml
Cat deploy/1.8+/metrics-server-deployment.yaml
Image: ispcdocker.com/dashboard/metrics-server-amd64:v0.3.3
ImagePullPolicy: IfNotPresent
Command:
-/ metrics-server
-metric-resolution=30s
-kubelet-insecure-tls
-kubelet-preferred-address-types=InternalIP,Hostname,InternalDNS,ExternalDNS,ExternalIP
VolumeMounts:
-name: tmp-dir
MountPath: / tmp
EOF
Kubectl create-f deploy/1.8+/
Cd
Kubectl-n kube-system get deployment metrics-server
Kubectl-n kube-system get pods
Kubectl-n kube-system top pods # This command need wait after 30 secend for system conllect performence dadta, else will give some error!
# 7.2 dashboard v1.10.1
Wget http://10.245.254.93/linux/soft/docker/kubernetes/heapster/v110/kubernetes-dashboard-1.10.1.yaml-O / root/kubernetes-dashboard.yaml
Sed-I "s | k8s.gcr.io | ispcdocker.com/dashboard | g" / root/kubernetes-dashboard.yaml
Sed-I "s | Opaque | NodePort | g" / root/kubernetes-dashboard.yaml
# Define Use fixed ports instead of dynamic ports
Sed-I "160a\\ nodePort: 30521" / root/kubernetes-dashboard.yaml
Sed-I "161a\\ type:\ NodePort" / root/kubernetes-dashboard.yaml
# 7.3-https://github.com/kubernetes/dashboard/wiki/Certificate-management
Openssl req-x509-nodes-newkey rsa:2048-sha256-days 999\
-keyout dashboard.key\
-out dashboard.crt\
-subj "/ C=CN/ST=docker/L=wuhan/O=ispc/OU=New site/CN=ispcdocker.com/emailAddress=macj@ispcdocker.com"
Mkdir / root/certs & & mv dashboard.* / root/certs
# 7.4-https://github.com/kubernetes/dashboard/wiki/Installation#recommended-setup
Kubectl create secret generic kubernetes-dashboard-certs-type=NodePort-from-file=$HOME/certs-n kube-system
Sed-I 1513 26d / root/kubernetes-dashboard.yaml
Kubectl create-f / root/kubernetes-dashboard.yaml
# 7.5. Change confg, and check dashboard web port
Kubectl-n kube-system get service kubernetes-dashboard
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT (S) AGE
Kubernetes-dashboard NodePort 192.168.176.140 443:30521/TCP 32s
# 7.6 If you don't want to grant admin permission to dashboard service account, you can create cluster admin service account.
# https://stackoverflow.com/questions/46664104/how-to-sign-in-kubernetes-dashboard
# Create service account
Kubectl create serviceaccount dashboard-sa-u1
# Bind ClusterAdmin role to the service account
Kubectl create clusterrolebinding dashboard-sa-u1\
-- clusterrole=cluster-admin\
-- serviceaccount=default:dashboard-sa-u1
# And then, you can use the token of just created cluster admin service account.
Kubectl describe secret $(
Kubectl get secret | awk'/ ^ dashboard-sa-u1-token-/ {print $1}'
) | awk'$1percent = "token:" {print $2}'
# 7.7 web login
Https://10.247.15.75:30521/#!/login
This is the end of the article on "how to configure kubeadm-install-kubernetes". Thank you for reading! I believe that everyone has a certain understanding of the knowledge of "how to configure kubeadm-install-kubernetes". If you want to learn more knowledge, you are welcome to follow the industry information channel.