docker系列6 :k8s集群[ 解压安装 ]
参考:https://blog.csdn.net/chen798213337/article/details/785010421,下载安装包root@wang-GA-MA770T-UD3P:/home/wang/Downloads/k8s# lsetcd-v3.3.10-linux-amd64.tar.gzkubernetes-node-linux-amd64.tar.gz...
·
参考:https://blog.csdn.net/chen798213337/article/details/78501042
1,下载安装包
root@wang-GA-MA770T-UD3P:/home/wang/Downloads/k8s# ls
etcd-v3.3.10-linux-amd64.tar.gz kubernetes-node-linux-amd64.tar.gz kubernetes.tar.gz
kubernetes-client-linux-amd64.tar.gz kubernetes-server-linux-amd64.tar.gz
解压etcd , server包,并把可执行文件复制到: /k8s/目录的bin 下
root@wang-GA-MA770T-UD3P:/home/wang/Downloads/k8s# ls /k8s/bin/
apiextensions-apiserver etcd hyperkube kube-aggregator kube-controller-manager kubelet kube-scheduler
cloud-controller-manager etcdctl kubeadm kube-apiserver kubectl kube-proxy
2,创建配置文件:service, conf
#环境变量
echo 'PATH=$PATH:/k8s/bin/'>>/etc/profile
source /etc/profile
==========================================/etc/systemd/system/etcd.service
[Unit]
Description=etcd.service
[Service]
Type=notify
TimeoutStartSec=0
Restart=always
WorkingDircotry=/k8s/lib/etcd
EnvironmentFile=-/k8s/conf/etcd.conf
ExecStart=/k8s/bin/etcd
[Install]
WantedBy=multi-user.target
----------/k8s/conf/etcd.conf
ETCD_NAME=ETCD Server
ETCD_DATA_DIR="/k8s/lib/etcd/"
ETCD_LISTEN_CLIENT_URLS="http://0.0.0.0:2379"
ETCD_ADVERTISE_CLIENT_URLS="http://192.168.56.1:2379"
systemctl daemon-reload
systemctl enable etcd.service
systemctl start etcd.service
=========================== /usr/lib/systemd/system/kube-apiserver.service
[Unit]
Description=kubernetes api server
After=etcd.service
Wants=etcd.service
[Service]
Type=notify
LimitNOFILE=65536
Restart=on-failure
EnvironmentFile=-/k8s/conf/apiserver.conf
ExecStart=/k8s/bin/kube-apiserver \
$KUBE_ETCD_SERVERS \
$KUBE-API_ADDRESS \
$KUBE_API_PORT \
$KUBE_SERVICE_ADDRESSES \
$KUBE_ADMISSION_CONTROL \
$KUBE_API_LOG \
$KUBE_API_ARGS
[Install]
WantedBy=multi-user.target
---- -----/k8s/conf/apiserver.conf
KUBE_API_ADDRESS="--insecure-bind-address=0.0.0.0"
KUBE_API_PORT="--insecure-port=8080"
KUBE_ETCD_SERVERS="--etcd-servers=http://192.168.56.1:2379"
KUBE_SERVICE_ADDRESSES="--service-cluster-ip-range=169.169.0.0/16"
KUBE_ADMISSION_CONTROL="--admission-control=NamespaceLifecycle,LimitRanger,SecurityContextDeny,ServiceAccount,ResourceQuota"
KUBE_API_LOG="--logtostderr=false --log-dir=/var/log/kubernets/apiserver --v=2"
KUBE_API_ARGS=" "
systemctl daemon-reload
systemctl enable kube-apiserver.service
systemctl start kube-apiserver.service
=========================== /usr/lib/systemd/system/kube-scheduler.service
[Unit]
Description=kube scheduler service
After=kube-apiserver.service
Requires=kube-apiserver.service
[Service]
User=root
LimitNOFILE=65536
Restart=on-failure
EnvironmentFile=-/k8s/conf/scheduler.conf
ExecStart=/k8s/bin/kube-scheduler \
$KUBE_MASTER \
$KUBE_SCHEDULER_ARGS
[Install]
WantedBy=multi-user.target
---- -----/k8s/conf/scheduler.conf
KUBE_MASTER="--master=http://192.168.56.1:8080"
KUBE_SCHEDULER_ARGS="--logtostderr=true --log-dir=/var/log/kubernetes/scheduler --v=2"
systemctl daemon-reload
systemctl enable kube-scheduler.service
systemctl start kube-scheduler.service
=========================== /usr/lib/systemd/system/kubelet.service
[Unit]
Description=kube controller manager service
[Service]
ExecStart=/k8s/bin/kubelet
Restart=always
StartLimitInterval=0
RestartSec=10
[Install]
WantedBy=multi-user.target
systemctl daemon-reload
systemctl enable kubelet.service
systemctl start kubelet.service
=========================== /usr/lib/systemd/system/kube-controller-manager.service
[Unit]
Description=kube controller manager service
After=kube-apiserver.service
Requires=kube-apiserver.service
[Service]
Type=notify
LimitNOFILE=65536
Restart=on-failure
EnvironmentFile=-/k8s/conf/crontroller-manager.conf
ExecStart=/k8s/bin/kube-controller-manager \
$KUBE_MASTER \
$KUBE_CONTROLLER_MANAGER_ARGS
[Install]
WantedBy=multi-user.target
---- -----/k8s/conf/crontroller-manager.conf
KUBE_MASTER="--master=http://192.168.56.1:8080"
KUBE_CONTROLLER_MANAGER_ARGS=" "
systemctl daemon-reload
systemctl enable kube-controller-manager.service
systemctl start kube-controller-manager.service
更多推荐
已为社区贡献12条内容
所有评论(0)