Demystifying kubeconfig file | kubeconfig file explained - Part 1

Поделиться
HTML-код
  • Опубликовано: 25 ноя 2024

Комментарии • 82

  • @dhirajdsharma
    @dhirajdsharma 10 месяцев назад +2

    this was actually awesome.

  • @ashfaqurtahashin564
    @ashfaqurtahashin564 2 года назад +3

    This is great tutorial. Thanks for sharing your knowledge with us. It helps a lot for newbies like me to understand in detail

  • @shreyasmateti2481
    @shreyasmateti2481 2 года назад +1

    most of your tutorials are very informative, thanks for your time to post these videos, keep posting any new features if you find going forward, thanks

  • @sachinmaurya3259
    @sachinmaurya3259 3 года назад +1

    Finally, I am able to understand kubeconfig file
    Awesome Video , Thank you :)

    • @viveksinghggits
      @viveksinghggits  3 года назад +1

      Hey 👋,
      Thanks Sachin. I am glad it was helpful.

  • @athenahealth4246
    @athenahealth4246 3 года назад +1

    I was searching for this. kubectl config.
    And I found this. Thanks

  • @wardaddyfury
    @wardaddyfury 3 года назад +2

    Very informative, I didn't know how kubectl searches for config file. Keep it up buddy :)

  • @happylucky5609
    @happylucky5609 11 дней назад

    @Vivek Singh : Could you make a video on using key and certs stored in pem files

  • @madhaiyanm4036
    @madhaiyanm4036 2 года назад +1

    Really detailed explanation about kube config. well done.

    • @viveksinghggits
      @viveksinghggits  2 года назад

      Thank you Madhaiyan. I am glad you liked it.

  • @sandeepharidasula3191
    @sandeepharidasula3191 3 года назад

    Thank you Vivek, for your tutorials.

    • @viveksinghggits
      @viveksinghggits  3 года назад

      Hey 👋 Sandeep,
      Thank you, I am glad you liked it.

  • @saba_mt
    @saba_mt 2 года назад +2

    Thank you, it is really nicely explained

  • @dipi411
    @dipi411 2 года назад +1

    Thanks, brother!!

  • @ashok.9761
    @ashok.9761 3 года назад

    These video's very usey self preparation guys 🙏
    Please make more videos sir

    • @viveksinghggits
      @viveksinghggits  3 года назад

      Hey 👋,
      Thanks Ashok. Yes I will make more videos for sure. I have already uploaded a lot of kubernetes related videos here, meanwhile you can check them out.

    • @ashok.9761
      @ashok.9761 3 года назад

      @@viveksinghggitsI am learning kubernates your channel bro

    • @viveksinghggits
      @viveksinghggits  3 года назад

      😊

  • @aaajjjay
    @aaajjjay 2 года назад +1

    Hi Vivek,
    In this video you wrote command "kubectl get ns". My question is how does it get the namspace information because in kubeconfig file there is only information about cluster and users. How does it get information about namespace. In similar way about pods, nodes, etc.
    Thanks

    • @viveksinghggits
      @viveksinghggits  2 года назад +2

      Hi 👋,
      The short answer is kubeconfig file doesn't store/have the k8s resources. The k8s resources are stored in another key value store usually ETCD.
      kubeconfig file just had details about where the api server is and how users/clients can authentic against thst api server.
      To get to know more about this you can watch some of the videos that I have made on Kubernetes architecture.

    • @rrryu4757
      @rrryu4757 2 года назад +1

      @@viveksinghggits I was searching the same issues.. Thanks :)

    • @viveksinghggits
      @viveksinghggits  2 года назад

      👍

  • @david2358
    @david2358 3 года назад +1

    Thank you for the tutorial 👍

  • @tukovbertrandm6453
    @tukovbertrandm6453 3 года назад +1

    Hi Vivek,
    Thanks for this video. can you please tell me how to replace the default config file with another...in your video you showed how to set up two config files to be access together, but what I really want to know is to how to replace one with another. Many thanks

    • @viveksinghggits
      @viveksinghggits  3 года назад +2

      Can we not just set the KUBECONFIG env var with the kubeconfig file that you want to use.
      I think that should work.

    • @tukovbertrandm6453
      @tukovbertrandm6453 3 года назад

      @@viveksinghggits sure it would work, but I was doing some online tutorials and it’s asking to replace the default config file instead. I think they want it to stay at /root/.kube directory , while my new config file is in the root directory.

    • @viveksinghggits
      @viveksinghggits  3 года назад

      Maybe I am not understanding the problem correctly but can't you move your file inside .kube dir and then set the KUBECONFIG env var accordingly.

    • @rrryu4757
      @rrryu4757 2 года назад

      @@tukovbertrandm6453 Use 'cp new_config_file ~/.kube/config' or you can manually update in /root/.kube/config

  • @abhishekghosh5550
    @abhishekghosh5550 8 месяцев назад

    How do i change the current context in a kubeconfig file?

    • @viveksinghggits
      @viveksinghggits  8 месяцев назад

      Google the same question and you should be able to find out the kubectl command to do that.

  • @Rosepoision
    @Rosepoision 3 года назад +1

    Try to make video for kubernetes 1.21 latest release , other than that how to backup cluster ,additionally rbac

    • @viveksinghggits
      @viveksinghggits  3 года назад +1

      Hey 👋,
      I already have a video on RBAC, I can share the link if you want to.
      I will try to make video on 1.21 maybe.
      When you say how to backup cluster, do you mean backup etcd (cluster state) or backing up deployed applications.

    • @Rosepoision
      @Rosepoision 3 года назад +1

      @@viveksinghggits thank you,sure please share the link, backup like complete configuration cluster, nodes like how vlero is doing it

    • @viveksinghggits
      @viveksinghggits  3 года назад +1

      Hey 👋,
      This is the link to RBAC video
      ruclips.net/video/gqhbnulGza4/видео.html

    • @Rosepoision
      @Rosepoision 3 года назад

      @@viveksinghggits thank you

    • @viveksinghggits
      @viveksinghggits  3 года назад

      👍

  • @bhushandhapodkar7577
    @bhushandhapodkar7577 5 месяцев назад

    file kaha pe milagi ??

  • @i_d_k3544
    @i_d_k3544 4 месяца назад

    Thanks Sir !!

  • @parimi001
    @parimi001 Год назад

    @vivek - How will you add cluster info using kubectl?

    • @viveksinghggits
      @viveksinghggits  Год назад

      Hi Venkat,
      I am not sure what exactly your question is, but I think this video has the answer. ruclips.net/video/XsFbUgZ0Ad8/видео.html
      If not, let me know the details about your question.

    • @parimi001
      @parimi001 Год назад

      @@viveksinghggits
      So like you said, there are 3 components of the kubeconfig file right.
      1. Cluster Info # What command will populate this section???
      2. Context # kubectl config set-context will map cluster info and user.
      3. Users # kubectl config set-credentials will set the user

    • @viveksinghggits
      @viveksinghggits  Год назад +1

      Did you watch the video that I linked above? That explains all these things.

  • @omega1962
    @omega1962 2 года назад

    While using multiple config files, suppose both the config files have default context set and if I execute any command like kubectl get ns, then which context is it going to consider?

    • @viveksinghggits
      @viveksinghggits  2 года назад

      How are you using multiple config files.

    • @omega1962
      @omega1962 2 года назад

      @@viveksinghggits I mean can we use multiple kubeconfig file? Also I need some help of EKS user access. Can you please guide? I have created EKS cluster and an EC2 machine. In EC2 machine, first I need to install kubectl, I am stuck here, how do I,
      1. Connect to the EKS cluster?
      2. I create a new linux user (useradd kishore), How can new user kishore get access to kube EKS cluster?
      Thanks in advance.

  • @יוניארליך-ע5פ
    @יוניארליך-ע5פ 2 года назад

    Hey! great video, and very helpful.
    Would love it if you invest in a better mic, and add subtitles (even if auto generated)
    Thank you, subbed!

    • @viveksinghggits
      @viveksinghggits  2 года назад

      Hi,
      Thank you. I actually have a mic but I don't use it. I thought the quality difference isn't that much. Also setting up mic in Ubuntu with OBS is a problem. But let's see if I would be able to figure that out.

    • @viveksinghggits
      @viveksinghggits  2 года назад

      The subtitles should be there on most of the videos, but I am not sure why we don't have subtitles in some videos, I will try to figure that out.

  • @DurgaPrasad-i9r
    @DurgaPrasad-i9r Год назад

    The problem statement and goal for this is as follows:
    A common Kubeconfig file is generated for each k8s cluster
    This kubeconfig file has full access to to the cluster
    The same kubeconfig file is used in the project pipelines which can be read by all developers
    This becomes a potential security issue
    The goal is to generate a restricted kubeconfig files for each project
    This kubeconfig file would have access to only the project namespace, not anything else.
    The same can be used in the project pipelines and shared with developers where necessary, without much security exposure.
    It would be great if this could be completed asap.

    • @viveksinghggits
      @viveksinghggits  Год назад

      I am not going to help here, because of obvious reasons.

  • @ankursinha286
    @ankursinha286 3 года назад

    in CKA exam they have a nested cluster kind of architecture. Can you explain how that is being setup. they have around 6 clusters and move between them using use-contexts. But i am not able to image how physically it must have been set. Also in kubeconfig it talks to kube-apiserver on port 6443. but i see in your kubeconfig it was a random port.

    • @viveksinghggits
      @viveksinghggits  3 года назад

      Hi Ankur,
      If we talk about 6 clusters in CKA exam, I don't think they are nested clusters.
      They are 6 actual clusters with their entry made in the kubeconfig file. And because of those six entries we can very easily switch which cluster we want to work on.

    • @viveksinghggits
      @viveksinghggits  3 года назад

      If we talk about the port thing, I agree api server usually runs on 6443 and in this case as well the same is happening.
      It's not clearly visible because the entire thing (k8s cluster) is setup using kind, and in that case every core component runs inside a container.
      So the port that we see in kubeconfig file is container port not the api server port.
      But eventually that's containers port is mapped to the api server pod port, which is 6443. I would also like to highlight that this is happening because we set up the cluster using kind.

    • @viveksinghggits
      @viveksinghggits  3 года назад

      Let me know if it doesn't make sense, I will be happy to answer anything else.

    • @ankursinha286
      @ankursinha286 3 года назад

      @@viveksinghggits Oh Okay got it thanks....And forgot to mention that your videos are too good and quite nicely explained.

    • @viveksinghggits
      @viveksinghggits  3 года назад

      Thanks for kind words Ankur 🙏.

  • @sakshirathore4670
    @sakshirathore4670 3 года назад

    Hi Thanks for the video. How can i add configmap configured for coreDNS in kube-system namespace in kubernetes default configuration so in future when i redeploy configmap will be alredy present in the cluster.

    • @viveksinghggits
      @viveksinghggits  3 года назад

      Hi Sakshi,
      Can you please explain the question a bit more.
      "when I re deploy" what exactly are you trying to re deploy.
      If you are asking about re deploying the k8s cluster and expecting the configmap from previous cluster to be present in new cluster I don't think that's possible.
      Also, why do you want to do that.

    • @sakshirathore4670
      @sakshirathore4670 3 года назад

      @@viveksinghggits we had to make an adjustment to the DNS in the two clusters. This is needed so that the applications in the cluster can talk to the keycloak without having to go over the external network.
      For this I had to add one line per environment in the ConfigMaps of coreDNS (namespace kube-system):
      On development:
      rewrite name exact login.ccp.test.web ingress-nginx-controller.ccp.svc.cluster.local
      rewrite name exact login.ccp.entw.web ingress-nginx-controller.ccp.svc.cluster.local
      On prod:
      rewrite name exact ingress-nginx-controller.ccp.svc.cluster.local
      Can i include this somewhere in the configuration for the clusters? So that e.g. in case of an upgrade or migration of cluster it is automatically available in the new cluster?
      😊

    • @viveksinghggits
      @viveksinghggits  3 года назад

      mm, sorry I am not sure if I would be able to help here. I think I am not able to understand the problem/use case.

    • @viveksinghggits
      @viveksinghggits  3 года назад

      I can try, if you maybe explain the use case in better way.

  • @sujatharacharla8023
    @sujatharacharla8023 Год назад +1

    helpful

  • @OmprakashYadavIIT
    @OmprakashYadavIIT 2 года назад +1

    nice

  • @anamigator
    @anamigator 3 года назад +1

    Because this came in my feed, just a suggestion, it's pronounced as kube-see-tee-el, not kube cutel

    • @viveksinghggits
      @viveksinghggits  3 года назад

      Hi Aditya,
      Thanks for feedback. I don't have a strong opinion but I don't think it's written somewhere officially that this is how it should be pronounced.
      Kubekuttle is easier that's why I use that.

    • @anamigator
      @anamigator 3 года назад +1

      @@viveksinghggits there’s a standard for calling system tools that control a background daemon. You’re free to call whatever you want, but in the sense of communication it’s convenient to stick to a standard that’s widely understood.

    • @viveksinghggits
      @viveksinghggits  3 года назад

      Hi Aditya,
      So two things here
      1. I have seen people using kube cuttle most of the time. I have seen even k8s authors using kube cuttle or kube cuddle.
      2. Kubectl is not a daemon.
      Again I don't have a strong opinion, you might be right but I think you would agree that saying kube cuttle is easier than kube CTL.

    • @viveksinghggits
      @viveksinghggits  3 года назад

      Or the better sentence would be
      2. Kubectl doesn't control a background daemon.

    • @anamigator
      @anamigator 3 года назад

      @@viveksinghggits sure, may be I’ve never come across this way of saying it. I didn’t mean kubectl controls a daemon, what I was referring to is kubectl talks to a daemon, right ?

  • @pravinrathod3475
    @pravinrathod3475 2 года назад

    Hi Vivek
    I am getting below error even if i have my
    kube config file in
    ~/.kube/config
    error: Missing or incomplete configuration info. Please point to an existing, complete config file:
    1. Via the command-line flag --kubeconfig
    2. Via the KUBECONFIG environment variable
    3. In your home directory as ~/.kube/config
    To view or setup config directly use the 'config' command.
    [ERROR] 2022-08-23T12:46:41.799944Z cmd.Run() failed with exit status 1
    [ERROR] 2022-08-23T12:46:41.799998Z Command exception: The login-to-ocp command failed (exit status 1). You may find output and logs in the "/home/pravin/install_dir/cpd-cli-workspace/olm-utils-workspace/work" directory.
    [ERROR] 2022-08-23T12:46:41.800691Z RunPluginCommand:Execution error: exit status 1