Skip to content

Instantly share code, notes, and snippets.

@mstruk
Created January 29, 2020 14:20
Show Gist options
  • Save mstruk/e479a3cf3984a087c850ea8f8f6cf28f to your computer and use it in GitHub Desktop.
Save mstruk/e479a3cf3984a087c850ea8f8f6cf28f to your computer and use it in GitHub Desktop.
Get Keycloak up and running on minishift
#
# Start Keycloak
#
cat <<EOF > keycloak-authz.yml
apiVersion: v1
kind: Service
metadata:
name: keycloak
labels:
app: keycloak
spec:
ports:
- name: http
port: 8080
targetPort: 8080
- name: https
port: 8443
targetPort: 8443
selector:
app: keycloak
type: NodePort
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: keycloak
spec:
replicas: 1
selector:
matchLabels:
app: keycloak
template:
metadata:
labels:
app: keycloak
spec:
containers:
- name: keycloak
image: jboss/keycloak
args:
- "-Dkeycloak.profile.feature.upload_scripts=enabled"
env:
- name: KEYCLOAK_USER
value: admin
- name: KEYCLOAK_PASSWORD
value: admin
- name: PROXY_ADDRESS_FORWARDING
value: "true"
ports:
- name: http
containerPort: 8080
- name: https
containerPort: 8443
readinessProbe:
httpGet:
path: /auth/realms/master
port: 8080
EOF
kubectl apply -f keycloak-authz.yml
kubectl get svc | grep keycloak
KEYCLOAK_PORT=$(kubectl get svc | grep keycloak | awk -F '8080:' '{print $2}' | awk -F '/' '{print $1}')
echo $KEYCLOAK_PORT
kubectl get pod
kubectl logs $(kubectl get pod | grep keycloak | awk '{print $1}')
KEYCLOAK_HOST=$(minishift ip)
echo http://$KEYCLOAK_HOST:$KEYCLOAK_PORT/auth/admin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment