Use Open ID Connect for Kubernetes API server

Sdílet
Vložit
  • čas přidán 30. 03. 2018
  • One of the most scalable approaches to Kubernetes Authentication has to be OpenID Connect Token. These JWT (Json Web Tokens) are issued by a third party (in our case Keycloak) Token Issuer. Kubernetes can then verify whether the token is valid, without having to query Token Issuer. This is what makes this setup quite decoupled and very scalable.
    In this video, you'll learn how to configure the apiserver using a minikube Kubernetes cluster. We're running Keycloak as an Identity Provider outside of the Cluster on our local machine using Docker. This leads us to yet another problem though: How can the Minikube cluster (which is running inside a virtual machine) access the Keycloak instance on the host machine? Learn how we tackle this and other issues in this brand new episode on Kubernetes Authentication.
  • Věda a technologie

Komentáře • 25

  • @ajaykumarkasam1201
    @ajaykumarkasam1201 Před rokem +1

    i feel this video is incomplete. keycloak issued id_token (with sub as uuid). but there is no mention in the video the configuration and settings at kubernetes to provide clusterrole / role and clusterrolebinding/rolebinding to provide authorization at the kubernetes for the trusted identity (value of uuid in sub claim)

  • @norm1124
    @norm1124 Před 5 lety +2

    Just an AMAZING video series. Thanks for sharing.

  • @tothetech
    @tothetech Před 2 lety

    Amazing, i am beginner and learned actual background of keycloak openid by your this video

  • @s1n7ax
    @s1n7ax Před 2 lety

    I'm doing completely unrelated stuff to Kubernetes but I find this really helpful to understand how OAuth 2 works.

  • @coolkrishna1234
    @coolkrishna1234 Před 4 lety

    Very much detailed video series.
    Thanks for sharing.

  • @cinooo2
    @cinooo2 Před 4 lety +1

    Really awesome series, thanks a lot. Also amazed by your shell setup hope you have other videos covering that too

    • @kubucation
      @kubucation  Před 4 lety

      Thanks, there's no dedicated video on the setup yet, but I linked my dotfiles ( github.com/etiennedi/dotfiles ) before in case you want to copy parts of the setup. Which topics would you like to see addressed in a video about the setup?

  • @snes87aysd8b
    @snes87aysd8b Před 4 lety

    Amazing video series, very thorough.

  • @BhavdeepHere
    @BhavdeepHere Před 2 lety

    Extremely well explained to make it understand

  • @vigneshs4219
    @vigneshs4219 Před 3 lety

    Very nice tutorial, very helpful. Please add about Authorization also

  • @joseaugusto7839
    @joseaugusto7839 Před rokem

    I just have to say thank you, man. the're perfect!

  • @jiaxiangwang4209
    @jiaxiangwang4209 Před 4 lety +2

    Hi, can you share your tmux theme? That is beautiful!

  • @sergiiiurchenko7245
    @sergiiiurchenko7245 Před 6 lety +1

    Thank you for a great video sets. Would be great to hear any advice about some helper/proxy for setting the config for kubectl in case token expiration time is to small.

    • @kubucation
      @kubucation  Před 6 lety

      Thanks for your feedback and your input. I'm not entirely sure I get what you're talking about? Do you mean a tool that will use the refresh_token to update the kubeconfig? Or just getting the token into the kubeconfig in an automated fashion? Or retrieving the token using various OAuth Flows and then setting it? Sounds like an interesting topic, I'd be happy to add a video about it, just let me know what it is exactly that you're interested in.

    • @sergiiiurchenko7245
      @sergiiiurchenko7245 Před 6 lety +1

      As it seems for me - some tool which can cache IDP credentials and update kubeconfig. Let me briefly describe case:
      Let's assume we have requirement to keep expiration timeout for refresh_token as short as possible(10 mins). I believe in Keycloak it's limited by "SSO Session Idle". So far we have option to set IDP params, tokens in kubeconfig as auth-provider-arg- parameters. And that would work perfectly, tokens would refreshes until user is calling kubectl APIs. Otherwise (idle timeout reached), user should requests new tokens and update kubeconfig. Would be great to have some more friendly way for that.

  • @genericnep
    @genericnep Před 2 lety

    At 15:48 , after starting minikube, I am stuck at the screen "Booting up control plane ...". Then I get a bunch of errors as follow:
    Waiting for the kubelet to boot up the control plane as static Pods from directory "/etc/kubernetes/manifests". This can take up to 4m0s
    [kubelet-check] Initial timeout of 40s passed.
    Unfortunately, an error has occurred:
    timed out waiting for the condition
    This error is likely caused by:
    - The kubelet is not running
    - The kubelet is unhealthy due to a misconfiguration of the node in some way (required cgroups disabled)
    If you are on a systemd-powered system, you can try to troubleshoot the error with the following commands:
    - 'systemctl status kubelet'
    - 'journalctl -xeu kubelet'
    Additionally, a control plane component may have crashed or exited when started by the container runtime.
    To troubleshoot, list all containers using your preferred container runtimes CLI.
    Here is one example how you may list all Kubernetes containers running in docker:
    - 'docker ps -a | grep kube | grep -v pause'
    Once you have found the failing container, you can inspect its logs with:
    - 'docker logs CONTAINERID'

  • @NaderHGhanbari
    @NaderHGhanbari Před 5 lety

    Nice tutorial. Out of curiosity, how does keycloak figure out that it's hit by `10.0.2.2` or `localhost`? Based on what address it's referred as, its response changes which has implications on further interactions with it (the realm base URL changes).

    • @abhishekdk5040
      @abhishekdk5040 Před 5 lety

      i didn't had this issue when running minikube and docker-toolbox in windows
      even from minikube i was able to curl the keycloak with the docker-machine ip
      $ minikube ssh
      $ curl -k 192.168.99.x:8443/auth/realms/master

  • @m1mohamad
    @m1mohamad Před 5 lety

    Nice channel, nice work, keep it going, suggest a full fledged K8s if was possible in the future even that minikube does the job for now

    • @kubucation
      @kubucation  Před 5 lety

      Thanks, glad you like it :) My experience is more with using and administering kubernetes clusters, not so much with operating them, so that's why I use minikube in the videos. The API is (almost) the same, but I can avoid a lot of the trouble involved with building real production grade clusters.

    • @m1mohamad
      @m1mohamad Před 5 lety

      @@kubucation I support managed production grade clusters in one of those Cloud providers, but I'm from a Windows background shifted my career recently so I am trying to improve since I'm very new to the K8s world

    • @kubucation
      @kubucation  Před 5 lety

      Interesting to know. Going for a managed solution is a good decision, the public cloud clusters are becoming better and better and operating it yourself is not an easy task. Interesting to hear you’re from a Windows background, I was thinking about creating a mini series about “Introduction to bash scripting” Is this something that would help you?

    • @m1mohamad
      @m1mohamad Před 5 lety

      Sure, Bash, Docker and anything that will help operating containers is something I like to see in this channel.
      Specially Microsoft still maturing their docker architecture, it's useful to look at the Windows side of things as I see it's being used on production grade solutions as well.
      Vielen Dank

  • @smiletolead
    @smiletolead Před 5 lety

    When I run minikube using the script start_minikube.sh, I am getting error 'Unknown flag --Authentication.OIDC.CAFile'
    I am using Kubernetes version V1.13.3

    • @DavidWalter3
      @DavidWalter3 Před 5 lety

      I'm not sure what version of kubernetes was in use but IIRC the name pattern changed from CamelCase to kebab-case sometime after kubernetes version 1.7 or 1.8 for the parameters ( hyphen-case lisp-case naming for hyphenation is apparently controversial )
      replacing your-ip:port
      minikube start \
      --extra-config=apiserver.oidc-issuer-url=your-ip:port \
      --extra-config=apiserver.oidc-username-claim=email \
      --extra-config=apiserver.oidc-groups-claim=groups \
      --extra-config=apiserver.oidc-client-id="dex-auth" \
      YMMV