Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Centos+k8s+docker deployment

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

I. Environment

Centos7

Host:

Master: hostname k8s-master, ip: 192.168.1.130

Node1: hostname k8s-node-1, ip:192.168.1.132

The / etc/hosts for both master and node are configured as follows

Cat / etc/hosts

192.168.1.130 k8s-master

192.168.1.130 etcd

192.168.1.130 registry

192.168.1.132 k8s-node-1

192.168.1.133 k8s-node-2

Master execution

# systemctl stop firewalld# systemctl disable firewalld

# setenforce 0

1. Install etcd and kubernetes-master using yum

# yum-y install etcd kubernetes-master

2.. Edit / etc/etcd/etcd.conf file

ETCD_NAME=defaultETCD_DATA_DIR= "/ var/lib/etcd/default.etcd" ETCD_LISTEN_CLIENT_URLS= "ETCD_ADVERTISE_CLIENT_URLS=" 3. Edit / etc/kubernetes/apiserver file KUBE_API_ADDRESS= "--insecure-bind-address=0.0.0.0" KUBE_API_PORT= "--port=8080" KUBELET_PORT= "--kubelet-port=10250" KUBE_ETCD_SERVERS= "--etcd-servers= KUBE_SERVICE_ADDRESSES="-- service-cluster-ip-range=10.254.0.0/16 "KUBE_ADMISSION_CONTROL="-- admission-control=NamespaceLifecycle,NamespaceExists,LimitRanger,SecurityContextDeny,ResourceQuota "KUBE_API_ARGS="4. Start etcd, kube-apiserver, kube-controller-manager, kube-scheduler and other services, and set boot # for SERVICES in etcd kube-apiserver kube-controller-manager kube-scheduler; do systemctl restart $SERVICES;systemctl enable $SERVICES;systemctl status $SERVICES; done 5. Define the flannel network # etcdctl mk / atomic.io/network/config'{"Network": "172.17.0.0 Universe 16"}'in etcd to install and configure Kubernetes Node 1. Use yum to install flannel and kubernetes-node # yum-y install flannel kubernetes-node 2. Specify the etcd service for the flannel network and modify the / etc/sysconfig/flanneld file FLANNEL_ETCD= "3. Modify / etc/kubernetes/config file KUBE_LOGTOSTDERR= "--logtostderr=true" KUBE_LOG_LEVEL= "--vici0" KUBE_ALLOW_PRIV= "--allow-privileged=false" KUBE_MASTER= "--master=4. Modify the configuration file / etc/kubernetes/kubelet KUBELET_ADDRESS= "--address=0.0.0.0" KUBELET_PORT= "--port=10250" KUBELET_HOSTNAME= "--hostname-override=192.168.1.132" # of the corresponding node to the IPKUBELET_API_SERVER= of the corresponding Node "--api-servers= http://192.168.30.20:8080" # specify the API ServerKUBELET_POD_INFRA_CONTAINER= of the Master node-- pod-infra-container-p_ W_picpath=registry.access.redhat.com/rhel7/pod-infrastructure:latest "KUBELET_ARGS="

5. Start services such as kube-proxy,kubelet,docker,flanneld on all Node nodes and set up boot.

# for SERVICES in kube-proxy kubelet docker flanneld;do systemctl restart $SERVICES;systemctl enable $SERVICES;systemctl status $SERVICES; done

Verify that the cluster is installed successfully

Execute the following command on master

# kubectl get node

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report