集群部署获取k8s二进制包

[root@master ~]# wget https://dl.k8s.io/v1.15.0/kubernetes-server-linux-amd64.tar.gz
[root@master ~]# ls
kubernetes-server-linux-amd64.tar.gz
[root@master ~]# mkdir master
[root@master ~]# mv kubernetes-server-linux-amd64.tar.tar master/
[root@master ~]# cd master/
[root@master master]# tar -zxf kubernetes-server-linux-amd64.tar.gz
[root@master master]# ls
kubernetes kubernetes-server-linux-amd64.tar.gz
[root@master master]# cd /root/master/kubernetes/server/bin
[root@master bin]# pwd
/root/master/kubernetes/server/bin
[root@master bin]# ls
apiextensions-apiserver kube-controller-manager.tar
cloud-controller-manager kubectl
cloud-controller-manager.docker_tag kubelet
cloud-controller-manager.tar kube-proxy
hyperkube kube-proxy.docker_tag
kubeadm kube-proxy.tar
kube-apiserver kube-scheduler
kube-apiserver.docker_tag kube-scheduler.docker_tag
kube-apiserver.tar kube-scheduler.tar
kube-controller-manager mounter
kube-controller-manager.docker_tag
[root@master bin]# cp kube-controller-manager kube-scheduler kube-apiserver /opt/kubernetes/bin/
[root@master bin]# chmod +x /opt/kubernetes/bin/*
[root@master bin]# ls /opt/kubernetes/bin/
etcd flanneld kube-controller-manager kube-scheduler
etcdctl kube-apiserver kubectl mk-docker-opts.sh
[root@master bin]# cat apiserver.sh
#!/bin/bash MASTER_ADDRESS=${1:-"192.168.230.130"}
ETCD_SERVERS=${2:-"http://127.0.0.01:2379"} cat <<EOF >/opt/kubernetes/cfg/kube-apiserver
KUBE_APISERVER_OPTS="--logtostderr=true \\
--v=4 \\
--etcd-servers=${ETCD_SERVERS} \\
--insecure-bind-address=127.0.0.1 \\
--bind-address=${MASTER_ADDRESS} \\
--insecure-port=8080 \\
--secure-port=6443 \\
--advertise-address=${MASTER_ADDRESS} \\
--allow_privileged=true \\
--service-cluster-ip-range=10.10.10.0/24 \\
--admission-control=NamespaceLifecycle,LimitRanger,SecurityContextDeny,ServiceAccount,ResourceQuota,NodeRestriction \
--authorization-mode=RBAC,Node \\
--kubelet-https=true \\
--enable-bootstrap-token-auth \\
--token-auth-file=/opt/kubernetes/cfg/token.csv \\
--service-node-port-range=30000-50000 \\
--tls-cert-file=/opt/kubernetes/ssl/server.pem \\
--tls-private-key-file=/opt/kubernetes/ssl/server-key.pem \\
--client-ca-file=/opt/kubernetes/ssl/ca.pem \\
--service-account-key-file=/opt/kubernetes/ssl/ca-key.pem \\
--etcd-cafile=/opt/kubernetes/ssl/ca.pem \\
--etcd-certfile=/opt/kubernetes/ssl/server.pem \\
--etcd-keyfile=/opt/kubernetes/ssl/server-key.pem"
EOF cat <<EOF >/usr/lib/systemd/system/kube-apiserver.service
[Unit]
Description=Kubernetes API Server
Documentation=https://github.com/kubernetes/kubernetes [Service]
EnvironmentFile=-/opt/kubernetes/cfg/kube-apiserver
ExecStart=/opt/kubernetes/bin/kube-apiserver \$KUBE_APISERVER_OPTS
Restart=on-failure [Install]
WantedBy=multi-user.target
EOF systemctl daemon-reload
systemctl enable kube-apiserver
systemctl restart kube-apiserver
[root@master bin]# sh apiserver.sh 192.168.238.130 https://192.168.238.130:2379,https://192.168.238.129:2379,https://192.168.238.128:2379
Created symlink from /etc/systemd/system/multi-user.target.wants/kube-apiserver.service to /usr/lib/systemd/system/kube-apiserver.service.
[root@master bin]# cat /opt/kubernetes/cfg/kube-apiserver
KUBE_APISERVER_OPTS=“--logtostderr=true \
--v=4 \
--etcd-servers=https://192.168.238.130:2379,https://192.168.238.129:2379,https://192.168.238.128:2379 \
--insecure-bind-address=127.0.0.1 \
--bind-address=192.168.238.130 \
--insecure-port=8080 \
--secure-port=6443 \
--advertise-address=192.168.238.130 \
--allow_privileged=true \
--service-cluster-ip-range=10.10.10.0/24 \
--admission-control=NamespaceLifecycle,LimitRanger,SecurityContextDeny,ServiceAccount,ResourceQuota,NodeRestriction --authorization-mode=RBAC,Node \
--kubelet-https=true \
--enable-bootstrap-token-auth \
--token-auth-file=/opt/kubernetes/cfg/token.csv \
--service-node-port-range=30000-50000 \
--tls-cert-file=/opt/kubernetes/ssl/server.pem \
--tls-private-key-file=/opt/kubernetes/ssl/server-key.pem \
--client-ca-file=/opt/kubernetes/ssl/ca.pem \
--service-account-key-file=/opt/kubernetes/ssl/ca-key.pem \
--etcd-cafile=/opt/kubernetes/ssl/ca.pem \
--etcd-certfile=/opt/kubernetes/ssl/server.pem \
--etcd-keyfile=/opt/kubernetes/ssl/server-key.pem"
[root@master bin]# cat /usr/lib/systemd/system/kube-apiserver.service
[Unit]
Description=Kubernetes API Server
Documentation=https://github.com/kubernetes/kubernetes [Service]
EnvironmentFile=-/opt/kubernetes/cfg/kube-apiserver
ExecStart=/opt/kubernetes/bin/kube-apiserver $KUBE_APISERVER_OPTS
Restart=on-failure [Install]
WantedBy=multi-user.target
[root@master bin]# cp /root/token.csv /opt/kubernetes/cfg/
[root@master bin]# systemctl daemon-reload
[root@master bin]# systemctl start kube-apiserver
[root@master bin]# systemctl status kube-apiserver
● kube-apiserver.service - Kubernetes API Server
Loaded: loaded (/usr/lib/systemd/system/kube-apiserver.service; enabled; vendor preset: disabled)
Active: active (running) since Mon 2019-07-08 00:19:12 CST; 5s ago
Docs: https://github.com/kubernetes/kubernetes
Main PID: 9389 (kube-apiserver)
Memory: 237.0M
CGroup: /system.slice/kube-apiserver.service
└─9389 /opt/kubernetes/bin/kube-apiserver --logtostderr=true --v=4 --etcd-servers=https://192.168.238.130:2379,https://... Jul 08 00:19:17 master kube-apiserver[9389]: I0708 00:19:17.303440 9389 wrap.go:42] GET /apis/rbac.authorization.k8s.io/v...40304]
Jul 08 00:19:17 master kube-apiserver[9389]: I0708 00:19:17.306232 9389 wrap.go:42] POST /apis/rbac.authorization.k8s.io/...40304]
Jul 08 00:19:17 master kube-apiserver[9389]: I0708 00:19:17.306446 9389 storage_rbac.go:208] created clusterrole.rbac.aut...o-edit
Jul 08 00:19:17 master kube-apiserver[9389]: I0708 00:19:17.312507 9389 wrap.go:42] GET /apis/rbac.authorization.k8s.io/v...40304]
Jul 08 00:19:17 master kube-apiserver[9389]: I0708 00:19:17.315463 9389 wrap.go:42] POST /apis/rbac.authorization.k8s.io/...40304]
Jul 08 00:19:17 master kube-apiserver[9389]: I0708 00:19:17.315628 9389 storage_rbac.go:208] created clusterrole.rbac.aut...o-view
Jul 08 00:19:17 master kube-apiserver[9389]: I0708 00:19:17.317279 9389 wrap.go:42] GET /apis/rbac.authorization.k8s.io/v...40304]
Jul 08 00:19:17 master kube-apiserver[9389]: I0708 00:19:17.320248 9389 wrap.go:42] POST /apis/rbac.authorization.k8s.io/...40304]
Jul 08 00:19:17 master kube-apiserver[9389]: I0708 00:19:17.320381 9389 storage_rbac.go:208] created clusterrole.rbac.aut...apster
Jul 08 00:19:17 master kube-apiserver[9389]: I0708 00:19:17.321952 9389 wrap.go:42] GET /apis/rbac.authorization.k8s.io/v...40304]
Hint: Some lines were ellipsized, use -l to show in full. [root@master bin]# cat controller-manager.sh
#!/bin/bash
MASTER_ADDRESS=${1:-"127.0.0.1"}
cat <<EOF >/opt/kubernetes/cfg/kube-controller-manager
KUBE_CONTROLLER_MANAGER_OPTS="--logtostderr=true \\
--v=4 \\
--master=${MASTER_ADDRESS}:8080 \\
--leader-elect=true \\
--address=127.0.0.1 \\
--service-cluster-ip-range=10.10.10.0/24 \\
--cluster-name=kubernetes \\
--cluster-signing-cert-file=/opt/kubernetes/ssl/ca.pem \\
--cluster-signing-key-file=/opt/kubernetes/ssl/ca-key.pem \\
--service-account-private-key-file=/opt/kubernetes/ssl/ca-key.pem \\
--root-ca-file=/opt/kubernetes/ssl/ca.pem"
EOF cat <<EOF >>/usr/lib/systemd/system/kube-controller-manager.service
[Unit]
Description=Kubernetes Controller Manager
Documentation=https://github.com/kubernetes/kubernetes [Service]
EnvironmentFile=-/opt/kubernetes/cfg/kube-controller-manager
ExecStart=/opt/kubernetes/bin/kube-controller-manager \$KUBE_CONTROLLER_MANAGER_OPTS
Restart=on-failure
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable kube-controller-manager
systemctl restart kube-controller-manager
[root@master bin]# sh controller-manager.sh 127.0.0.1
Created symlink from /etc/systemd/system/multi-user.target.wants/kube-controller-manager.service to /usr/lib/systemd/system/kube-controller-manager.service.
[root@master bin]# systemctl status kube-controller-manager
● kube-controller-manager.service - Kubernetes Controller Manager
Loaded: loaded (/usr/lib/systemd/system/kube-controller-manager.service; enabled; vendor preset: disabled)
Active: active (running) since Mon 2019-07-08 01:11:38 CST; 52s ago
Docs: https://github.com/kubernetes/kubernetes
Main PID: 9647 (kube-controller)
Memory: 125.4M
CGroup: /system.slice/kube-controller-manager.service
└─9647 /opt/kubernetes/bin/kube-controller-manager --logtostderr=true --v=4 --master=127.0.0.1:8080 --leader-elect=true... Jul 08 01:12:29 master kube-controller-manager[9647]: I0708 01:12:29.568788 9647 cronjob_controller.go:128] Found 0 jobs
Jul 08 01:12:29 master kube-controller-manager[9647]: I0708 01:12:29.568802 9647 cronjob_controller.go:134] Found 0 groups
Jul 08 01:12:29 master kube-controller-manager[9647]: I0708 01:12:29.795439 9647 reflector.go:160] Listing and watching *v...o:133
Jul 08 01:12:29 master kube-controller-manager[9647]: E0708 01:12:29.796578 9647 reflector.go:125] k8s.io/client-go/inform...ource
Jul 08 01:12:29 master kube-controller-manager[9647]: I0708 01:12:29.801372 9647 reflector.go:160] Listing and watching *v...o:133
Jul 08 01:12:29 master kube-controller-manager[9647]: E0708 01:12:29.801927 9647 reflector.go:125] k8s.io/client-go/inform...s.io)
Jul 08 01:12:30 master kube-controller-manager[9647]: I0708 01:12:30.797753 9647 reflector.go:160] Listing and watching *v...o:133
Jul 08 01:12:30 master kube-controller-manager[9647]: E0708 01:12:30.798917 9647 reflector.go:125] k8s.io/client-go/inform...ource
Jul 08 01:12:30 master kube-controller-manager[9647]: I0708 01:12:30.802656 9647 reflector.go:160] Listing and watching *v...o:133
Jul 08 01:12:30 master kube-controller-manager[9647]: E0708 01:12:30.803446 9647 reflector.go:125] k8s.io/client-go/inform...s.io)
Hint: Some lines were ellipsized, use -l to show in full.
[root@master bin]# cat scheduler.sh
#!/bin/bash
MASTER_ADDRESS=${1:-"127.0.0.1"}
cat <<EOF >/opt/kubernetes/cfg/kube-scheduler
KUBE_SCHEDULER_OPTS="--logtostderr=true \\
--v=4 \\
--master=${MASTER_ADDRESS}:8080 \\
--leader-elect"
EOF cat <<EOF >/usr/lib/systemd/system/kube-scheduler.service
[Unit]
Description=Kubernetes Scheduler
Documentation=https://github.com/kubernetes/kubernetes
[Service]
EnvironmentFile=-/opt/kubernetes/cfg/kube-scheduler
ExecStart=/opt/kubernetes/bin/kube-scheduler \$KUBE_SCHEDULER_OPTS
Restart=on-failure
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable kube-scheduler
systemctl restart kube-scheduler
[root@master bin]# sh scheduler.sh 127.0.0.1
Created symlink from /etc/systemd/system/multi-user.target.wants/kube-scheduler.service to /usr/lib/systemd/system/kube-scheduler.service.
[root@master bin]# systemctl status kube-scheduler
● kube-scheduler.service - Kubernetes Scheduler
Loaded: loaded (/usr/lib/systemd/system/kube-scheduler.service; enabled; vendor preset: disabled)
Active: active (running) since Mon 2019-07-08 01:19:33 CST; 20s ago
Docs: https://github.com/kubernetes/kubernetes
Main PID: 9717 (kube-scheduler)
Memory: 41.8M
CGroup: /system.slice/kube-scheduler.service
└─9717 /opt/kubernetes/bin/kube-scheduler --logtostderr=true --v=4 --master=127.0.0.1:8080 --leader-elect Jul 08 01:19:35 master kube-scheduler[9717]: I0708 01:19:35.039679 9717 shared_informer.go:176] caches populated
Jul 08 01:19:35 master kube-scheduler[9717]: I0708 01:19:35.140505 9717 shared_informer.go:176] caches populated
Jul 08 01:19:35 master kube-scheduler[9717]: I0708 01:19:35.241452 9717 shared_informer.go:176] caches populated
Jul 08 01:19:35 master kube-scheduler[9717]: I0708 01:19:35.342335 9717 shared_informer.go:176] caches populated
Jul 08 01:19:35 master kube-scheduler[9717]: I0708 01:19:35.443425 9717 shared_informer.go:176] caches populated
Jul 08 01:19:35 master kube-scheduler[9717]: I0708 01:19:35.543503 9717 shared_informer.go:176] caches populated
Jul 08 01:19:35 master kube-scheduler[9717]: I0708 01:19:35.643839 9717 shared_informer.go:176] caches populated
Jul 08 01:19:35 master kube-scheduler[9717]: I0708 01:19:35.643976 9717 leaderelection.go:235] attempting to acquire lead...ler...
Jul 08 01:19:35 master kube-scheduler[9717]: I0708 01:19:35.653106 9717 leaderelection.go:245] successfully acquired leas...eduler
Jul 08 01:19:35 master kube-scheduler[9717]: I0708 01:19:35.754649 9717 shared_informer.go:176] caches populated
Hint: Some lines were ellipsized, use -l to show in full.
[root@master bin]# cat /opt/kubernetes/cfg/kube-controller-manager
KUBE_CONTROLLER_MANAGER_OPTS="--logtostderr=true \
--v=4 \
--master=127.0.0.1:8080 \
--leader-elect=true \
--address=127.0.0.1 \
--service-cluster-ip-range=10.10.10.0/24 \
--cluster-name=kubernetes \
--cluster-signing-cert-file=/opt/kubernetes/ssl/ca.pem \
--cluster-signing-key-file=/opt/kubernetes/ssl/ca-key.pem \
--service-account-private-key-file=/opt/kubernetes/ssl/ca-key.pem \
--root-ca-file=/opt/kubernetes/ssl/ca.pem"
[root@master bin]# cat /opt/kubernetes/cfg/kube-scheduler
KUBE_SCHEDULER_OPTS="--logtostderr=true \
--v=4 \
--master=127.0.0.1:8080 \
--leader-elect"
查看状态
[root@master bin]# kubectl get cs
NAME STATUS MESSAGE ERROR
scheduler Healthy ok
controller-manager Healthy ok
etcd-1 Healthy {"health": "true"}
etcd-2 Healthy {"health": "true"}
etcd-0 Healthy {"health": "true"}

kubernetes容器集群管理部署master节点组件的更多相关文章

  1. kubernetes容器集群管理部署node节点组件

    发送配置文件到各个节点 [root@master ~]# scp /opt/kubernetes/cfg/*kubeconfig root@192.168.238.128:/opt/kubernete ...

  2. Kubernetes容器集群管理环境 - Node节点的移除与加入

    一.如何从Kubernetes集群中移除Node比如从集群中移除k8s-node03这个Node节点,做法如下: 1)先在master节点查看Node情况 [root@k8s-master01 ~]# ...

  3. kubernetes容器集群管理创建node节点kubeconfig文件

    1.创建TLS Bootstrapping Token 2.创建kubelet kubeconfig 3.创建kube-proxy kubeconfig 安装和设置kubectl [root@mast ...

  4. Kubernetes容器集群管理环境 - 完整部署(中篇)

    接着Kubernetes容器集群管理环境 - 完整部署(上篇)继续往下部署: 八.部署master节点master节点的kube-apiserver.kube-scheduler 和 kube-con ...

  5. Kubernetes容器集群管理环境 - 完整部署(下篇)

    在前一篇文章中详细介绍了Kubernetes容器集群管理环境 - 完整部署(中篇),这里继续记录下Kubernetes集群插件等部署过程: 十一.Kubernetes集群插件 插件是Kubernete ...

  6. Kubernetes容器集群管理环境 - Prometheus监控篇

    一.Prometheus介绍之前已经详细介绍了Kubernetes集群部署篇,今天这里重点说下Kubernetes监控方案-Prometheus+Grafana.Prometheus(普罗米修斯)是一 ...

  7. Kubernetes容器集群管理环境 - 完整部署(上篇)

    Kubernetes(通常称为"K8S")是Google开源的容器集群管理系统.其设计目标是在主机集群之间提供一个能够自动化部署.可拓展.应用容器可运营的平台.Kubernetes ...

  8. kubeadm部署k8s1.9高可用集群--4部署master节点

    部署master节点 kubernetes master 节点包含的组件: kube-apiserver kube-scheduler kube-controller-manager 本文档介绍部署一 ...

  9. kubernetes容器集群管理启动一个测试示例

    创建nginx 创建3个nginx副本 [root@master bin]# kubectl run nginx --image=nginx --replicas=3 kubectl run --ge ...

随机推荐

  1. ajax中的application/x-www-form-urlencoded中的使用[转]

    一,HTTP上传的基本知识 在Form元素的语法中,EncType表明提交数据的格式 用 Enctype 属性指定将数据回发到服务器时浏览器使用的编码类型.下边是说明: application/x-w ...

  2. vue下超级滚动条perfect-scrollbar(在特定框架里使用一款并非为该框架定制的库/插件)

    点我查看

  3. IDEA中写xml配置文件的时候没有代码提示

    问题情境:如开发SSM应用的时候,编写xml配置mapper.xml文件没有代码提示,这个问题应该是编写的xml文件中没有找到需要的dtd文件. 在xml文件中的引入约束的标签如下: <!DOC ...

  4. demo板 apt-get install stress

    demo 那个网口 没有绑定mac 大电脑绑定了mac 大电脑上网认证系统:http://1.1.1.2 大电脑mac:6C-4B-90-3C-D5-7B 将demo板的mac改为大电脑mac ifc ...

  5. apache You don't have permission to access / on this server.无权访问

    环境:ubuntu16.4 apache2 原因:修改了apache web项目路径 解决: 1. 修改 /etc/apache2/sites-available/000-default.conf 文 ...

  6. 计蒜客NOIP模拟D1T2

    原题: 蒜头君有一棵有根树,树的每一边都有边权,蒜头君想知道任意两点间最短距离之和为多少.另外,由于各种原因,蒜头君的树的边的边权会发生若干次改变,蒜头君想让你告诉他,每一次改变后,任意两点间最短距离 ...

  7. python之 matplotlib模块之基本三图形(直线,曲线,直方图,饼图)

    matplotlib模块是python中一个强大的绘图模块 安装 pip  install matplotlib 首先我们来画一个简单的图来感受它的神奇 import numpy as np impo ...

  8. Did you mean to run dotnet SDK commands

    把所有的net core的sdk,runtime,hosting通通卸载重新安装了2.1.1版本,发现再运行dotnet命令就是下面信息: C:\Users\Administrator>dotn ...

  9. LinuxMySQL主从复制原理图

    主库开启dump线程 从bin-log中取出数据 从库开启io线程和sql线程   io线程不断从主库中的dump线程中那到最新的bin-log和io线程中的master-info的数据进行比较,如果 ...

  10. python练习题之随机生成验证码

    #引用random模块下的randint项目#定义验证码函数.定义一个空字符串变量,分三种情况,随机产生的大写字母,随机产生的小写字母,随机产生的数字.然后#每一次执行哪一种情况,条件也是随机的,就是 ...