Kubernetes
来源:互联网 发布:无印良品文具淘宝 编辑:程序博客网 时间:2024/05/07 09:23
1、Kubernetes是Google开源的容器集群管理系统
其提供应用部署、维护、 扩展机制等功能,利用Kubernetes能方便地管理跨机器运行容器化的应用,其主要功能如下:
(1)使用Docker对应用程序包装(package)、实例化(instantiate)、运行(run)。
(2)以集群的方式运行、管理跨机器的容器。
(3)解决Docker跨机器容器之间的通讯问题。
(4)Kubernetes的自我修复机制使得容器集群总是运行在用户期望的状态。
2、以下是 Kubernetes 集群的主要组件:
(1)主节点:监督一个或多个节点(下属)的集群管理器。
(2)节点、下属或从节点:负责启动容器的集群成员。
(3)Pod:Kubernetes 中的基本操作单元。它表示一个或多个容器,这些容器构成一个在从节点(下属)上运行的应用程序(或部件)。
3、安装和设置 Kubernetes
确保以下 Unicamp 存储库添加到了将包含在 Kubernetes 集群中的所有系统:
# cat > /etc/yum.repos.d/unicamp-docker.repo <<EOF[unicamp-docker]name=Unicamp Repo for Docker Packagesbaseurl=http://ftp.unicamp.br/pub/ppc64el/rhel/7_1/docker-ppc64el/enabled=1gpgcheck=0EOF # cat > /etc/yum.repos.d/unicamp-misc.repo <<EOF[unicamp-misc]name=Unicamp Repo for Misc Packagesbaseurl=http://ftp.unicamp.br/pub/ppc64el/rhel/7_1/misc_ppc64el/enabled=1gpgcheck=0EOF4、安装和设置 Kubernetes 主节点
(1)安装所需的包。
# yum install kubernetes-client kubernetes-master etcd(2)打开 Network Ports。默认情况下,kubernetes api 服务器在端口 8080 上监听 kubelets。确保它未被本地防火墙拦截。如果使用了防火墙,可运行以下命令来打开一个针对公共区域的 TCP 端口。
# firewall-cmd --zone=public --add-port=8080/tcp --permanent# firewall-cmd --reload(3)此外,etcd 服务器默认情况下在端口 2379 上执行监听。按照以下说明打开相应的端口:
# firewall-cmd --zone=public --add-port=2379/tcp --permanent# firewall-cmd –reload(4)配置 Kubernetes 主节点。对于剩余配置步骤,假设 Kubernetes 主节点拥有 IP 地址 192.168.122.76,Kubernetes 节点拥有 IP 地址 192.168.122.236。
根据环境来修改 /etc/kubernetes/config 文件。基于上述信息,修改的文件具有以下内容:
# logging to stderr means we get it in the systemd journal KUBE_LOGTOSTDERR="--logtostderr=true"# journal message level, 0 is debugKUBE_LOG_LEVEL="--v=0"# Should this cluster be allowed to run privileged docker containersKUBE_ALLOW_PRIV="--allow-privileged=false"# How the controller-manager, scheduler, and proxy find the apiserverKUBE_MASTER="--master=http://192.168.122.76:8080"
(5)根据环境来修改 /etc/kubernetes/apiserver 文件。基于上述信息,修改的文件具有以下内容:
# logging to stderr means we get it in the systemd journal KUBE_LOGTOSTDERR="--logtostderr=true"# journal message level, 0 is debugKUBE_LOG_LEVEL="--v=0"# Should this cluster be allowed to run privileged docker containersKUBE_ALLOW_PRIV="--allow-privileged=false"# How the controller-manager, scheduler, and proxy find the apiserverKUBE_MASTER="--master=http://192.168.122.76:8080"(6)配置 Etcd。修改 /etc/etcd/etcd.conf 文件中的以下两个参数,如下所述:
ETCD_LISTEN_CLIENT_URLS="http://0.0.0.0:2379"ETCD_ADVERTISE_CLIENT_URLS="http://0.0.0.0:2379"(7)启动服务。
ETCD_LISTEN_CLIENT_URLS="http://0.0.0.0:2379"ETCD_ADVERTISE_CLIENT_URLS="http://0.0.0.0:2379"5、安装和设置 Kubernetes 节点(下属)
(1)安装所需的包。
# yum install docker-io kubernetes-client kubernetes-node(2)配置 Kubernetes 节点。根据环境来修改 /etc/kubernetes/ kubelet。基于上述信息,修改的文件具有以下内容:
# kubernetes kubelet (minion) config# The address for the info server to serve on (set to 0.0.0.0 or "" for all interfaces)KUBELET_ADDRESS="--address=0.0.0.0"# The port for the info server to serve on# KUBELET_PORT="--port=10250"# You may leave this blank to use the actual hostnameKUBELET_HOSTNAME=" "# location of the api-serverKUBELET_API_SERVER="--api-servers=http://192.168.122.76:8080"# Add your own!KUBELET_ARGS="—pod-infra-container-image=gcr.io/google_containers/pause-ppc64le:2.0"(3)启动服务。
# kubernetes kubelet (minion) config# The address for the info server to serve on (set to 0.0.0.0 or "" for all interfaces)KUBELET_ADDRESS="--address=0.0.0.0"# The port for the info server to serve on# KUBELET_PORT="--port=10250"# You may leave this blank to use the actual hostnameKUBELET_HOSTNAME=" "# location of the api-serverKUBELET_API_SERVER="--api-servers=http://192.168.122.76:8080"# Add your own!KUBELET_ARGS="—pod-infra-container-image=gcr.io/google_containers/pause-ppc64le:2.0"(4)验证设置。登录到主节点并运行 kubectl get nodes 来检查可用节点。
# kubernetes kubelet (minion) config# The address for the info server to serve on (set to 0.0.0.0 or "" for all interfaces)KUBELET_ADDRESS="--address=0.0.0.0"# The port for the info server to serve on# KUBELET_PORT="--port=10250"# You may leave this blank to use the actual hostnameKUBELET_HOSTNAME=" "# location of the api-serverKUBELET_API_SERVER="--api-servers=http://192.168.122.76:8080"# Add your own!KUBELET_ARGS="—pod-infra-container-image=gcr.io/google_containers/pause-ppc64le:2.0"从集群中的任何节点登录到私有注册表,以获取注册表身份验证 config 文件。
# docker login https://registry-rhel71.kube.com:5000# cat /root/.docker/config.json { "auths": { "https://registry-rhel71.kube.com:5000": { "auth": "cHJhZGlwdGE6cHJhZGlwdGE=", "email": "test@test.com" }}将此配置文件 (config.json) 复制到 Kubernetes 集群中的所有节点,方法是将其复制到路径 /root/.docker/config.json。该集群现在已设置为使用私有注册表服务器。
详细介绍请看:https://www.ibm.com/developerworks/cn/linux/l-docker-orchestration/index.html
推荐阅读:https://www.kubernetes.org.cn/3280.html
Kubernetes在Github的地址: https://github.com/kubernetes/dashboard
Kubernetes权威指南下载地址:http://www.xpgod.com/soft/49232.html
- Kubernetes
- Kubernetes
- Kubernetes
- Kubernetes
- Kubernetes
- Kubernetes
- Kubernetes
- Kubernetes
- Kubernetes
- Kubernetes
- Kubernetes
- Kubernetes
- Kubernetes
- Kubernetes
- Kubernetes
- Kubernetes初探
- Kubernetes试验
- Kubernetes初探
- 1.2 每一个对象都有一个接口
- 06_张孝祥_多线程_ThreadLocal类及应用技巧
- interrupte
- python代理ip抓取大众点评
- 标记语言Markdown介绍以及日常使用
- Kubernetes
- MyJdbcTemplate 常用的方法总结
- 执行远程调试jar命令
- 共享baidu.com,sohu.com,360.cn,qq.com,sina.com等二级域名
- [NOI2010]超级钢琴(可持续化线段树)
- C 语言大量重复使用 if else 时,大概率执行的执行体是放在 if 中还是 else 中对执行效率的影响
- Win32 API消息函数:PostMessage
- 数据结构 查找 散列表(Hash)(1)
- (浅谈)Java反射机制的使用