This repository was archived by the owner on Jun 28, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Configuring a Koris cluster to use Dex
- Loading branch information
Showing
23 changed files
with
1,842 additions
and
158 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -107,3 +107,6 @@ ENV/ | |
# mypy | ||
.mypy_cache/ | ||
.idea | ||
|
||
# VSCode project settings | ||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
apiVersion: extensions/v1beta1 | ||
kind: Deployment | ||
metadata: | ||
labels: | ||
app: dex | ||
name: dex | ||
spec: | ||
replicas: 1 | ||
template: | ||
metadata: | ||
labels: | ||
app: dex | ||
spec: | ||
serviceAccountName: dex # This is created below | ||
containers: | ||
- image: quay.io/dexidp/dex:v2.10.0 | ||
name: dex | ||
command: ["/usr/local/bin/dex", "serve", "/etc/dex/cfg/config.yaml"] | ||
|
||
ports: | ||
- name: https | ||
containerPort: 5556 | ||
|
||
volumeMounts: | ||
- name: config | ||
mountPath: /etc/dex/cfg | ||
- name: tls | ||
mountPath: /etc/dex/tls | ||
|
||
# Your app-id and app-secret need to be provided as env variables | ||
# env: | ||
# - name: GITLAB_CLIENT_ID | ||
# valueFrom: | ||
# secretKeyRef: | ||
# name: gitlab-client | ||
# key: client-id | ||
# - name: GITLAB_CLIENT_SECRET | ||
# valueFrom: | ||
# secretKeyRef: | ||
# name: gitlab-client | ||
# key: client-secret | ||
|
||
volumes: | ||
- name: config | ||
configMap: | ||
name: dex | ||
items: | ||
- key: config.yaml | ||
path: config.yaml | ||
- name: tls | ||
secret: | ||
secretName: dex.tls | ||
--- | ||
kind: ConfigMap | ||
apiVersion: v1 | ||
metadata: | ||
name: dex | ||
data: | ||
config.yaml: | | ||
issuer: https://127.0.0.1:32000 | ||
storage: | ||
type: kubernetes | ||
config: | ||
inCluster: true | ||
web: | ||
https: 0.0.0.0:5556 | ||
tlsCert: /etc/dex/tls/tls.crt | ||
tlsKey: /etc/dex/tls/tls.key | ||
# Add your connectors | ||
# connectors: | ||
# - type: gitlab | ||
# id: gitlab | ||
# name: Gitlab | ||
# config: | ||
# baseURL: https://gitlab.com | ||
# clientID: $GITLAB_CLIENT_ID | ||
# clientSecret: $GITLAB_CLIENT_SECRET | ||
# redirectURI: https://127.0.0.1:32000/callback | ||
oauth2: | ||
skipApprovalScreen: true | ||
# If desired, add your static clients | ||
# staticClients: | ||
# - id: example-app | ||
# redirectURIs: | ||
# - 'http://127.0.0.1:5555/callback' | ||
# name: 'Example App' | ||
# secret: ZXhhbXBsZS1hcHAtc2VjcmV0 | ||
enablePasswordDB: true | ||
# If desired, add static passwords | ||
# staticPasswords: | ||
# - email: "[email protected]" | ||
# # bcrypt hash of the string "password" | ||
# hash: "$2a$10$2b2cU8CPhOTaGrs1HRQuAueS7JTT5ZHsHSzYiFPm1leZck7Mc8T4W" | ||
# username: "admin" | ||
# userID: "08a8684b-db88-4b73-90a9-3cd1661f5466" | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: dex | ||
spec: | ||
type: NodePort | ||
ports: | ||
- name: dex | ||
port: 5556 | ||
protocol: TCP | ||
targetPort: 5556 | ||
nodePort: 32000 | ||
selector: | ||
app: dex | ||
--- | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
labels: | ||
app: dex | ||
name: dex | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1beta1 | ||
kind: ClusterRole | ||
metadata: | ||
name: dex | ||
rules: | ||
- apiGroups: ["dex.coreos.com"] # API group created by dex | ||
resources: ["*"] | ||
verbs: ["*"] | ||
- apiGroups: ["apiextensions.k8s.io"] | ||
resources: ["customresourcedefinitions"] | ||
verbs: ["create"] # To manage its own resources, dex must be able to create customresourcedefinitions | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1beta1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
name: dex | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
name: dex | ||
subjects: | ||
- kind: ServiceAccount | ||
name: dex # Service account assigned to the dex pod, created above | ||
namespace: default # The namespace dex is running in |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
kind: Service | ||
apiVersion: v1 | ||
metadata: | ||
name: dex-example-app | ||
labels: | ||
app: dex-example-app | ||
spec: | ||
selector: | ||
app: dex-example-app | ||
type: NodePort | ||
ports: | ||
# Change your ports accordingly | ||
- name: callback | ||
port: 5555 | ||
nodePort: 32555 | ||
targetPort: http | ||
--- | ||
apiVersion: extensions/v1beta1 | ||
kind: Deployment | ||
metadata: | ||
labels: | ||
app: dex-example-app | ||
name: dex-example-app | ||
spec: | ||
replicas: 1 | ||
template: | ||
metadata: | ||
labels: | ||
app: dex-example-app | ||
spec: | ||
containers: | ||
- name: dex-example-app | ||
image: obitech/dex-example-app | ||
# Configure your issuer and redirect accordingly | ||
args: ["--issuer", "https://127.0.0.1:32000", | ||
"--issuer-root-ca", "/etc/dex/tls/dex-ca.pem", | ||
"--listen", "http://0.0.0.0:5555", | ||
"--redirect-uri", "http://127.0.0.1:5555/callback"] | ||
ports: | ||
- name: http | ||
containerPort: 5555 | ||
volumeMounts: | ||
- name: root-ca | ||
mountPath: /etc/dex/tls | ||
volumes: | ||
- name: root-ca | ||
secret: | ||
secretName: dex.root-ca |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
kind: ClusterRoleBinding | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
metadata: | ||
name: your-user-binding | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
name: cluster-admin | ||
subjects: | ||
- kind: User | ||
name: your-user-here |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.