配置OKD 使用github.com OAuth2.0登陸
1. 前往github增加OAuth App
- 獲取到Client ID,Client Secret
https://github.com/organizations/goistop/settings/applications/new
image.png
2. 修改master-config.yaml
oauthConfig:
assetPublicURL: https://master.okd.goxx.top/console/
grantConfig:
method: auto
identityProviders:
# -------- add start---------
- name: github
challenge: false
login: true
mappingMethod: claim # lookup, generate, add
provider:
apiVersion: v1
kind: GitHubIdentityProvider
#ca: ... # github.com 無需配置
clientID: 00b9b0bf1fc2a21b13386
clientSecret: 99613a0febb23287492aacedeaaa8f5c52a4c0b70
#hostname: ... # github.com 無需配置
organizations: # 允許登陸的組織
- goistop
#teams: # 允許登陸的組
#- xx
# ---------- add end--------------
- challenge: true
login: true
mappingMethod: claim
name: htpasswd_auth
provider:
apiVersion: v1
file: /etc/origin/master/htpasswd
kind: HTPasswdPasswordIdentityProvider
mappingMethod 說明:
-
claim
用戶不存在將會自動創(chuàng)建嚣镜,之后可以去分配權(quán)限爬迟。 -
lookup
查找用戶是否存在,不存在則登陸失敗菊匿。 -
generate
重新生成一個用戶并添加到okd users中付呕。 -
add
用戶如果已經(jīng)存在,增加一個github登陸等映射標(biāo)識跌捆。
4. 重啟OKD控制服務(wù)
[okd@master-1 ~]$ sudo /usr/local/bin/master-restart api
2
[okd@master-1 ~]$ sudo /usr/local/bin/master-restart controllers
2
- 測試發(fā)現(xiàn)徽职,多個master時,需要修改每個master配置文件疹蛉,并依此重啟okd控制服務(wù)活箕。