Kubernetes ServiceAccount的配置
开始配置Kubernetes集群的时候为了少出问题,都是在apiserver配置中去掉ServiceAccount采用非安全连接的方式,但在后面配置FEK日志的过程中,很多时候绕不开这个安全机制,但因为开始在centos上安装是通过yum的方式,所以那些ca.crt,server.crt,kubecfg.key等文件都是没有的。自己手工去建了好几次最后都有一些问题。
本文是基于git-hub中make-ca-cert方式自己建立,方法如下:
先把github中kubernetes代码都下栽到master本地。
# git clone https://github.com/kubernetes/kubernetes |
修改make-ca-cert.sh,将第30行修改为kube(基于kube的组进行启动)
# update the below line with the group that exists on Kubernetes Master.
/* Use the user group with which you are planning to run kubernetes services */
cert_group=${CERT_GROUP:-kube}
运行make-ca-cert.sh
# cd kubernetes/cluster/saltbase/salt/generate-cert/ bash make-ca-cert.sh "192.168.0.105" "IP:192.168.0.105,IP:10.254.0.1,DNS:kubernetes,DNS:kubernetes.default,DNS:kubernetes.default.svc,DNS:kubernetes.default.svc.cluster.local"
这里192.168.0.105是master节点的ip,这种方式有个问题是master的ip变化的化证书可能有问题。不知道是否支持主机名设置。
运行完后发现在/srv/kubernetes目录下已经把相关的key都生成了,把这些key考到所有的minion节点的相同目录。
然后配置/etc/kubernetes/apiserver
KUBE_API_ARGS= "--secure-port=443 --client-ca-file=/srv/kubernetes/ca.crt --tls-cert-file=/srv/kubernetes/server.cert --tls-private-key-file=/srv/kubernetes/server.key" |
配置/etc/kubernetes/controller-manager
KUBE_CONTROLLER_MANAGER_ARGS= "--root-ca-file=/srv/kubernetes/ca.crt --service-account-private-key-file=/srv/kubernetes/server.key" |
启动master和minion完成
systemctl enable kube-apiserver
systemctl start kube-apiserver
systemctl enable kube-controller-manager
systemctl start kube-controller-manager
systemctl start kube-scheduler
systemctl start kube-scheduler
systemctl enable flanneld
systemctl start flanneld
systemctl enable kube-proxy
systemctl start kube-proxy
systemctl enable kubelet
systemctl start kubelet
systemctl enable flanneld
systemctl start flanneld
systemctl enable docker
systemctl start docker
May 24 08:07:09 k8s-master pulseaudio[3094]: [alsa-sink-Intel ICH] alsa-sink.c: ALSA woke us up to write new data to the device, but there was actually nothing to write!
May 24 08:07:09 k8s-master pulseaudio[3094]: [alsa-sink-Intel ICH] alsa-sink.c: Most likely this is a bug in the ALSA driver 'snd_intel8x0'. Please report this issue to the ALSA developers.
May 24 08:07:09 k8s-master pulseaudio[3094]: [alsa-sink-Intel ICH] alsa-sink.c: We were woken up with POLLOUT set -- however a subsequent snd_pcm_avail() returned 0 or another value < min_avail.
May 24 08:07:47 k8s-master systemd: Starting Kubernetes API Server...
May 24 08:07:47 k8s-master kube-apiserver: Flag --port has been deprecated, see --insecure-port instead.
May 24 08:07:47 k8s-master kube-apiserver: I0524 08:07:47.680379 4239 config.go:562] Will report 192.168.0.105 as public IP address.
May 24 08:07:47 k8s-master kube-apiserver: E0524 08:07:47.726082 4239 reflector.go:199] k8s.io/kubernetes/plugin/pkg/admission/resourcequota/resource_access.go:83: Failed to list *api.ResourceQuota: Get http://0.0.0.0:8080/api/v1/resourcequotas?resourceVersion=0: dial tcp 0.0.0.0:8080: getsockopt: connection refused
May 24 08:07:47 k8s-master kube-apiserver: E0524 08:07:47.726161 4239 reflector.go:199] k8s.io/kubernetes/plugin/pkg/admission/serviceaccount/admission.go:119: Failed to list *api.Secret: Get http://0.0.0.0:8080/api/v1/secrets?fieldSelector=type%3Dkubernetes.io%2Fservice-account-token&resourceVersion=0: dial tcp 0.0.0.0:8080: getsockopt: connection refused
May 24 08:07:47 k8s-master kube-apiserver: E0524 08:07:47.726207 4239 reflector.go:199] k8s.io/kubernetes/plugin/pkg/admission/serviceaccount/admission.go:103: Failed to list *api.ServiceAccount: Get http://0.0.0.0:8080/api/v1/serviceaccounts?resourceVersion=0: dial tcp 0.0.0.0:8080: getsockopt: connection refused
May 24 08:07:47 k8s-master kube-apiserver: [restful] 2017/05/24 08:07:47 log.go:30: [restful/swagger] listing is available at https://192.168.0.105:443/swaggerapi/
May 24 08:07:47 k8s-master kube-apiserver: [restful] 2017/05/24 08:07:47 log.go:30: [restful/swagger] https://192.168.0.105:443/swaggerui/ is mapped to folder /swagger-ui/
May 24 08:07:47 k8s-master kube-apiserver: E0524 08:07:47.902354 4239 reflector.go:199] pkg/controller/informers/factory.go:89: Failed to list *api.Namespace: Get http://0.0.0.0:8080/api/v1/namespaces?resourceVersion=0: dial tcp 0.0.0.0:8080: getsockopt: connection refused
May 24 08:07:47 k8s-master kube-apiserver: E0524 08:07:47.902419 4239 reflector.go:199] pkg/controller/informers/factory.go:89: Failed to list *api.LimitRange: Get http://0.0.0.0:8080/api/v1/limitranges?resourceVersion=0: dial tcp 0.0.0.0:8080: getsockopt: connection refused
May 24 08:07:47 k8s-master systemd: Started Kubernetes API Server.
May 24 08:07:47 k8s-master kube-apiserver: I0524 08:07:47.923462 4239 serve.go:95] Serving securely on 0.0.0.0:443
May 24 08:07:47 k8s-master kube-apiserver: I0524 08:07:47.923542 4239 serve.go:109] Serving insecurely on 0.0.0.0:8080
我对这个Failed to list *api.Secret的错误查了半天网上的材料想要消除,但后来看起来应该没有太大影响.
如果通过systemctl 启动不成功,可能尝试命令行启动.
APIServer和Controller Manager的命令行启动方式
Kubernetes ServiceAccount的配置的更多相关文章
- kubernetes Traefik ingress配置详解
理解Ingress 简单的说,ingress就是从kubernetes集群外访问集群的入口,将用户的URL请求转发到不同的service上.Ingress相当于nginx.apache等负载均衡方向代 ...
- Kubernetes 学习18配置网络插件flannel
一.概述 1.我们在学习docker时知道docker有四种常用的网络模型 a.bridge:桥接式网络 b.joined:联盟式网络,共享使用另外一个容器的网络名称空间 b.opened:容器直接共 ...
- Kubernetes DNS服务配置案例
首先创建DNS服务的RC配置文件skydns-rc.yaml apiVersion: v1 kind: ReplicationController metadata: name: kube-dns-v ...
- Kubernetes 1.5 配置dashboard
配置kubernetes的dashboard相对简单.同样的,只需要从源码中获取到dashboard-controller.yaml及dashboard-service.yaml文件,稍加修改即可: ...
- Kubernetes: 集群网络配置 - flannel
参考: [ Kubernetes 权威指南 ] Kubernetes 集群搭建可以参考 [ Kubernetes : 多节点 k8s 集群实践 ] 在多个 Node 组成的 Kubernetes 集群 ...
- Kubernetes DNS的配置
Kubernetes集群机制通过DNS进行服务名和ip的映射,如果没有配置dns,你可以通过下面命令查询到集群ip kubectl get svc --namespace=kube-system 得到 ...
- kubernetes节点安装配置
#环境安装,要与控制节点一致Centos 7 Linux release 7.3.1611网络: 互通配置主机名设置各个服务器的主机名hosts#查找kubernetes支持的docker版本Kube ...
- [Kubernetes]集群配置免密登录Permission denied (publickey,password) 解决办法
在用ansible部署Kubernetes集群是需要配置免密登录,但是遇到Permission denied (publickey,password)的问题 首先推断可能是sshd_config的配置 ...
- Kubernetes 使用 ingress 配置 https 集群(十五)
目录 一.背景 1.1 需求 1.2 Ingress 1.3 环境介绍 二.安装部署 2.1.创建后端 Pod 应用 2.2 创建后端 Pod Service 2.3.创建 ingress 资源 2. ...
随机推荐
- 游戏中的过程生成——元胞自动机 Celluar Automata 生成洞穴地形
最近在学习过程生成技术,在这里写一些心得. 对于元胞自动机,我们这里只讨论输入是一副二维bool数组的情况,即大多数游戏中的情况. 一个元胞自动机,对于一个输入,给出一个同样格式的输出.输出中的每个点 ...
- Django-csrf跨站请求伪造
方式一: 下列代码插入ajax提交之$.ajaxSetup({ data: {csrfmiddlewaretoken: '{{ csrf_token }}' }, }); 注意:该代码中包含模板渲染语 ...
- PHP代码中input控件使用id无法POST传值,使用name就可以
<html> <head> <title>Example</title> </head> <body> <?php if ...
- UVALIVE 5096 Volume
This time your job is to calculate the volume of a special object. The object consists of two orthog ...
- Hibernate 和 Mybatis的区别
第一方面:开发速度的对比 就开发速度而言,Hibernate的真正掌握要比Mybatis来得难些.Mybatis框架相对简单很容易上手,但也相对简陋些.个人觉得要用好Mybatis还是首先要先理解好H ...
- KVM(七)使用 libvirt 做 QEMU/KVM 快照和 Nova 实例的快照
本文将梳理 QEMU/KVM 快照相关的知识,以及在 OpenStack Nova 中使用 libvirt 来对 QEMU/KVM 虚机做快照的过程. 1. QEMU/KVM 快照 1.1 概念 QE ...
- **Git本地仓库图解
Git基本概念 在Git中,我们将需要进行版本控制的文件目录叫做一个仓库(repository),每个仓库可以简单理解成一个目录,这个目录里面的所有文件都通过Git来实现版本管理,Git都能跟踪并记录 ...
- [BZOJ1853][Scoi2010]幸运数字 容斥+搜索剪枝
1853: [Scoi2010]幸运数字 Time Limit: 2 Sec Memory Limit: 64 MBSubmit: 3202 Solved: 1198[Submit][Status ...
- MySql 分页关键字(limit)
mysql分页关键字: limit m,n --m:表示从哪一行开始查,n:查询多少条 oracle分页关键字:: rownum SqlServer:top(2005以下版本) row_number ...
- HDU 6324.Problem F. Grab The Tree-博弈(思维) (2018 Multi-University Training Contest 3 1006)
6324.Problem F. Grab The Tree 题目看着好难,但是题解说的很简单,写出来也很简单.能想出来就是简单的,想不出来就难(讲道理,就算是1+1的题目,看不出来就是难的啊). 和后 ...