-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from pinepain/k8s-ingress-nginx
Add k8s ingress-nginx support
- Loading branch information
Showing
403 changed files
with
16,161 additions
and
159,711 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 |
---|---|---|
@@ -1 +1,2 @@ | ||
ldap-auth-proxy | ||
ldap-auth-proxy | ||
vendor |
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 |
---|---|---|
@@ -1 +1,2 @@ | ||
ldap-auth-proxy | ||
ldap-auth-proxy | ||
vendor |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,30 @@ | ||
# Usage with ingress-nginx in Kubernetes | ||
|
||
Note: this is quick and dirty example how to get started, for production use you'd probably want | ||
to store LDAP credentials in secrets. | ||
|
||
This example focuses on JumpCloud LDAP, though any generic LDAP server would work just fine. | ||
|
||
## Usage: | ||
|
||
|
||
Replace following values in `ldap-auth-proxy.yaml`: | ||
|
||
- `<OID>` with your JumpCloud organisation id. | ||
- `<LDAP_BIND_USER>` with your JumpCloud LDAP bind user name. | ||
- `<LDAP_BIND_PASSWORD>` with your JumpCloud LDAP bind user password. | ||
|
||
e.g.: | ||
|
||
- `<OID>` => `4200000000` | ||
- `<LDAP_BIND_USER>` => `jrandom` | ||
- `<LDAP_BIND_PASSWORD>` => `password123` | ||
|
||
Also replace `yourdomain.com` in both `httpbin.yaml` and `ldap-auth-proxy.yaml` to your domain. | ||
|
||
Now let's deploy all of this to kubernetes: | ||
|
||
``` | ||
kubectl apply -f ldap-auth-proxy.yaml | ||
kubectl apply -f httpbin.yaml | ||
``` |
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,46 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: httpbin | ||
spec: | ||
ports: | ||
- port: 80 | ||
targetPort: 80 | ||
selector: | ||
app: httpbin | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: httpbin | ||
spec: | ||
selector: | ||
matchLabels: | ||
app: httpbin | ||
replicas: 1 | ||
template: | ||
metadata: | ||
labels: | ||
app: httpbin | ||
spec: | ||
containers: | ||
- name: httpbin | ||
image: kennethreitz/httpbin | ||
--- | ||
apiVersion: extensions/v1beta1 | ||
kind: Ingress | ||
metadata: | ||
name: httpbin-ingress | ||
annotations: | ||
kubernetes.io/ingress.class: nginx | ||
nginx.ingress.kubernetes.io/auth-url: http://auth.yourdomain.com | ||
# Alternatively, you can just refer to internal service without exposing auth to the outside | ||
#nginx.ingress.kubernetes.io/auth-url: http://ldap-auth-proxy.default.svc.cluster.local | ||
spec: | ||
rules: | ||
- host: httpbin.yourdomain.com | ||
http: | ||
paths: | ||
- backend: | ||
serviceName: httpbin | ||
servicePort: 80 |
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,66 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: ldap-auth-proxy | ||
spec: | ||
ports: | ||
- port: 80 | ||
targetPort: 8888 | ||
selector: | ||
app: ldap-auth-proxy | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: ldap-auth-proxy | ||
spec: | ||
selector: | ||
matchLabels: | ||
app: ldap-auth-proxy | ||
replicas: 1 | ||
template: | ||
metadata: | ||
labels: | ||
app: ldap-auth-proxy | ||
spec: | ||
containers: | ||
- name: ldap-auth-proxy | ||
image: pinepain/ldap-auth-proxy | ||
ports: | ||
- containerPort: 8888 | ||
env: | ||
- name: LOG_LEVEL | ||
value: "debug" | ||
- name: LISTEN | ||
value: ":8888" | ||
- name: LDAP_SERVER | ||
value: "ldaps://ldap.jumpcloud.com" | ||
- name: LDAP_BASE | ||
value: "o=<OID>,dc=jumpcloud,dc=com" | ||
- name: LDAP_BIND_DN | ||
value: "uid=<LDAP_BIND_USER>,ou=Users,o=<OID>,dc=jumpcloud,dc=com" | ||
- name: LDAP_BIND_PASSWORD | ||
value: "<LDAP_BIND_PASSWORD>" | ||
- name: LDAP_USER_FILTER | ||
value: "(uid=%s)" | ||
- name: LDAP_GROUP_FILTER | ||
value: "(&(objectClass=groupOfNames)(member=uid=%s,ou=Users,o=<OID>,dc=jumpcloud,dc=com))" | ||
- name: HEADERS_MAP | ||
value: "X-LDAP-Mail:mail,X-LDAP-UID:uid,X-LDAP-CN:cn" | ||
- name: URL_PATH_AUTH | ||
value: "/_external-auth-:orig-location-template" | ||
--- | ||
apiVersion: extensions/v1beta1 | ||
kind: Ingress | ||
metadata: | ||
name: auth-ingress | ||
annotations: | ||
kubernetes.io/ingress.class: nginx | ||
spec: | ||
rules: | ||
- host: auth.yourdomain.com | ||
http: | ||
paths: | ||
- backend: | ||
serviceName: ldap-auth-proxy | ||
servicePort: 80 |
Oops, something went wrong.