[ Kube 8 ] Kubernetes Namespaces & Contexts

in this video I will explain about Kubernetes Namespaces and contexts and how to switch between contexts.
Github: github.com/justmeandopensourc...
For any questions/issues/feedback, please leave me a comment and I will get back to you as quickly as I can. If you liked this video, please share it with your friends and don't forget to subscribe to my channel.
Hope you found this video informative and useful. Thanks for watching.
If you wish to support me:
www.paypal.com/cgi-bin/webscr...
#kubernetes #k8s #namespaces #k8scontexts #justmekubernetes

Пікірлер: 99

  • @jagadeesh0014
    @jagadeesh00143 жыл бұрын

    Once Again Thanks For Such a Wonderful Tutorial on Namespaces & Contexts.

  • @justmeandopensource

    @justmeandopensource

    3 жыл бұрын

    Hi Jagan, thanks for watching.

  • @saeedzf
    @saeedzf Жыл бұрын

    Thanks for this series for K8s. I followed your video about LXD and now found the K8s series excellent.

  • @justmeandopensource

    @justmeandopensource

    Жыл бұрын

    Hi Saeed, thanks for your interest in this channel.

  • @kanavpeer7926
    @kanavpeer79265 жыл бұрын

    i would recommend these series must watch, if you are new to kubernetes. Very good explained.

  • @justmeandopensource

    @justmeandopensource

    5 жыл бұрын

    Hi Kanav, Thanks for watching this video and for your valuable comment. Thanks, Venkat

  • @romantsyupryk3009
    @romantsyupryk30094 жыл бұрын

    Thank you so much for this tutorial.

  • @justmeandopensource

    @justmeandopensource

    4 жыл бұрын

    Hi Roman, thanks for watching. Cheers.

  • @rupeshgawas4905
    @rupeshgawas4905 Жыл бұрын

    Great info

  • @justmeandopensource

    @justmeandopensource

    Жыл бұрын

    Thanks for watching.

  • @OpenToLearn
    @OpenToLearn Жыл бұрын

    Excellent video

  • @taiwoesoimeme2383
    @taiwoesoimeme2383 Жыл бұрын

    Amazing Video Bhai.

  • @justmeandopensource

    @justmeandopensource

    Жыл бұрын

    Thanks for watching.

  • @arunreddy3844
    @arunreddy38444 жыл бұрын

    It's really nice one .

  • @justmeandopensource

    @justmeandopensource

    4 жыл бұрын

    Hi Arun, thanks for watching this video.

  • @RK-wk6zn
    @RK-wk6zn4 жыл бұрын

    thanks for clarifying the context part. It was really confusing for me.

  • @justmeandopensource

    @justmeandopensource

    4 жыл бұрын

    Thanks for watching this video.

  • @AnyRussian800
    @AnyRussian8005 жыл бұрын

    It is one of the best Kubernetes channels. Thanks

  • @justmeandopensource

    @justmeandopensource

    5 жыл бұрын

    Many thanks for watching this video and your comment. Much appreciated. Keep watching for more Kubernetes topics. Thanks, Venkat

  • @AnyRussian800

    @AnyRussian800

    5 жыл бұрын

    @@justmeandopensource i use kns + fzf for switching contexts Its very comfortable

  • @justmeandopensource

    @justmeandopensource

    5 жыл бұрын

    @@AnyRussian800 never heard of it. But interested in trying it out. Thanks.

  • @AnyRussian800

    @AnyRussian800

    5 жыл бұрын

    @@justmeandopensource here link to github github.com/blendle/kns There is Demo gif.

  • @AnyRussian800

    @AnyRussian800

    4 жыл бұрын

    Are you tried it, Bro? I'm using kns and ktx every day. And i'm using kubernetes extension for zsh + oh my zsh. It's very useful

  • @khaleelshaikabdul6401
    @khaleelshaikabdul64014 жыл бұрын

    Hi Venkat, Hope you are doing good. Nice Video on Namespace, Can you please do the video on Multi-tenancy on baremetal or VM.

  • @sridharreddypullangari5446
    @sridharreddypullangari54464 жыл бұрын

    I like your way of explanation , please make video on how to connect to remote kubernetes cluster from our local machine using Kubectl. Thank you.

  • @justmeandopensource

    @justmeandopensource

    4 жыл бұрын

    Hi Sridhar, thanks for watching. To connect to any Kubernetes cluster, all you need is a kubeconfig file. Kubernetes cluster administrator can provide you with a kubeconfig file which you can copy to (on Linux) ~/.kube/config to start using kubectl.

  • @mihaimyh
    @mihaimyh5 жыл бұрын

    Hi, first off all I want to thank you for your efforts on creating these videos, I am learning alot. Can you please be so kind and tell me what Linux distribution are you using and which desktop UI is that? Gnome, KDE?

  • @justmeandopensource

    @justmeandopensource

    5 жыл бұрын

    Hi Mihai, Thanks for watching this video and taking time to comment. I used Arch Linux with Gnome desktop environment during recording this video. But recently switched to Fedora 30. I prefer rolling release. Thanks, Venkat

  • @bhanukumar2590
    @bhanukumar25904 жыл бұрын

    Hi Venkat, As usual, ultimate video. May I know, in which scenario we need to make use of namespaces in first place? Like u explained, we can create same resource in multiple namespaces,..but if I am working on a project, when I should be using namespaces? Can't we setup our entire app to be running on single default namespace. Do we really come across a situation, where we might need to create a same resource in different namespaces? Or is it just like environment ex: production,test,uat?

  • @justmeandopensource

    @justmeandopensource

    4 жыл бұрын

    Hi Bhanu, thanks for watching. Although you can run everything in one namespace, in real world production usecase its better to isolate resources into different namespaces. You will find it easier to manage access if you split into namespaces. Also when your cluster grows bigger, it will be easier to manage security at namespace level. You can have different namespaces per project or per team or per environment likedev, staging and production. Or even they can be on different cluster for even more easier management. Cheers.

  • @aayush3377
    @aayush33773 жыл бұрын

    what would be the overall differences (multi cluster, user and namespace enviroment) between namespace and context ??

  • @omkargawade7256
    @omkargawade72563 жыл бұрын

    Hey Venkat...I have one question..is it possible that one pod(example. application pod) in one namespace could communicate with other pod (example. database) if yes then how?

  • @naveenkumarreddygangireddy2459

    @naveenkumarreddygangireddy2459

    3 жыл бұрын

    Yes Pods can communicate with each other irrespective of namespaces by default. If we don't want them to communicate we can make use of network policies

  • @saurabhagarwal5692
    @saurabhagarwal56924 жыл бұрын

    Hi Venkat....hope you are doing good...I have one question....If i create one name space for Developer is Dev and one for Tester is Test.As a admin i can switch context.But how can assign Dev Namespace for Developer and Test for Tester.My cluster is running On KOPS.Thanks

  • @jalandharbehera2456
    @jalandharbehera24562 жыл бұрын

    🙏🙏🙏🙏

  • @justmeandopensource

    @justmeandopensource

    2 жыл бұрын

    Thanks for watching.

  • @chennareddy2770
    @chennareddy27703 жыл бұрын

    Hi Venkat, I am new to k8s and i was to referred your channel by one of my friend. You are very straight to the point and crisp and clear. Thank you for sharing the knowledge. I have created contexts and when i switched to different context and try getting the pods list i get this error message " The connection to the server localhost:8080 was refused - did you specify the right host or port?" . Am i doing any thing wrong here. I have just followed your steps exactly for creating namespace and creating context and switching.

  • @justmeandopensource

    @justmeandopensource

    3 жыл бұрын

    Hi Chenna, thanks for watching. Could you please paste all the commands you have tried along with its output? You can use pastebin.com to share it. Meanwhile I can quickly check this video.

  • @chennareddy2770

    @chennareddy2770

    3 жыл бұрын

    @@justmeandopensource wow , this is super , so quick to respond . I have made mistake it was a typo error , i have corrected it and it is working now . And thank you again for such a quick response .

  • @justmeandopensource

    @justmeandopensource

    3 жыл бұрын

    @@chennareddy2770 Cool. I just brought up the cluster and was going through this video to check if anything has changed. It was done close to two years ago. Anyways you saved me some time. Cheers.

  • @wisdom514
    @wisdom5145 жыл бұрын

    Hi venkat, Hope you are doing well, Can different types namespaces talk to each other.?

  • @justmeandopensource

    @justmeandopensource

    5 жыл бұрын

    Hi Kapil, could you please elaborate your question? I didn't get it. Thanks

  • @manikandans8808
    @manikandans88085 жыл бұрын

    Namespaces can be used for defining environments such production, testing etc?

  • @justmeandopensource

    @justmeandopensource

    5 жыл бұрын

    Yes. Of course.

  • @waterkingdom9839
    @waterkingdom98395 жыл бұрын

    Good video on Kubernetes Namespaces. One quick clarification, what if I want to switch between the Clusters? How will a sample config file look like?

  • @justmeandopensource

    @justmeandopensource

    5 жыл бұрын

    Hi, Thanks for watching this video. You can have separate kubeconfig file for each cluster you want to access under $HOME/.kube directory. For example, lets say you have two clusters and you have two kubeconfig file like below. $HOME/.kube/cluster1-config $HOME/.kube/cluster2-config If you want to access cluster1, you can export KUBECONFIG variable and access it. export KUBECONFIG=$HOME/.kube/cluster1-config Now you can run kubectl command and interact with the cluster. Or, you can pass the config file as parameter to kubectl command like this. kubectl --kubeconfig=$HOME/.kube/cluster1-config get deployments Or, you can have a single config file $HOME/.kube/config for both the clusters. You will have to define contexts for each namespace in the cluster and then you can use them like below. kubectl config use-context Check the below doc for more information. kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/ Thanks.

  • @waterkingdom9839

    @waterkingdom9839

    5 жыл бұрын

    @@justmeandopensource thanks Venkat. Will try it out

  • @justmeandopensource

    @justmeandopensource

    5 жыл бұрын

    @@waterkingdom9839 No worries. Cheers.

  • @waterkingdom9839

    @waterkingdom9839

    4 жыл бұрын

    @@justmeandopensource Hello Venkat, just wanted to request if you can pre-pone the recording on Istio or any other traffic manager. There are couple of ways in which Istio can be used but not getting the right direction to get started since concepts are clear but unable to use with my own containers. I want to get started from basic using a simple web server for traffic splitting rather than using standard application e.g. Bookinfo which comes bundled with Istio.

  • @justmeandopensource

    @justmeandopensource

    4 жыл бұрын

    @@waterkingdom9839 Sure. I actually was playing with Istio for short while but haven't recorded anything yet. There are 3 videos waiting to be released. After that you can see Istio ones. Thanks.

  • @fujinclado4918
    @fujinclado49184 жыл бұрын

    Hi, do you have any recommendation for k8s books. For advanced users.

  • @justmeandopensource

    @justmeandopensource

    4 жыл бұрын

    Hi Fujin, thanks for watching. I personally go through kubernetes.io. But there is this google docs link where someone put together different learning resources. docs.google.com/spreadsheets/d/1l_p7dzmBO_fRQ5p3lp0PvaCBi7sOfqCOoCdj9vI6MZU/edit#gid=0 Thanks.

  • @fujinclado4918

    @fujinclado4918

    4 жыл бұрын

    @@justmeandopensource , Thanks a lot man.

  • @justmeandopensource

    @justmeandopensource

    4 жыл бұрын

    @@fujinclado4918 You are welcome. Cheers.

  • @_siva_polisetty
    @_siva_polisetty5 жыл бұрын

    Hi venkat, thanks for the video, I have a doubt, can we create multiple namespace under context? Like Development context under that namespaces with test1 test2 as well production context namespace test1 test2 namespace names are same(content under the namespace are different) contexts are different, If I change the context it should show only pods(related development nginx pods) if I changed to production it should show only production nginx pods, will it be possible

  • @justmeandopensource

    @justmeandopensource

    5 жыл бұрын

    Hi Siva, Contexts are for users and Kubernetes cluster is only aware of namespaces. You can create as many namespaces as you want. Contexts are a way of telling which cluster you want to connect to, which namespace you want to use and as which user you want to authenticate. You can't have multiple namespaces tied to a context. You won't see any error when you try to create context with multiple namespaces like below. "kubectl config set-context production --namespace=prod1 --namespace=prod2 --user=kubernetes-admin --cluster=kubernetes" But it will only use one namespace. In the above case, it will only use the last option which is prod2. Contexts are 1 to 1 mapping with a (cluster-namespace-user) Hope this helps. Thanks

  • @_siva_polisetty

    @_siva_polisetty

    5 жыл бұрын

    @@justmeandopensource thanks you so much Venkat

  • @Abhi-qi6wm

    @Abhi-qi6wm

    Жыл бұрын

    @@justmeandopensource So, contexts are abstractions for us to determine a fixed set of cluster, namespace and user to use.

  • @justmeandopensource

    @justmeandopensource

    Жыл бұрын

    @@Abhi-qi6wm exactly

  • @mmlmahesh
    @mmlmahesh3 жыл бұрын

    Hi venkat,can we rename the namespace in kuberntes? I wanted to know if we can change the “default” namespaces to other namespace with some standard set to my organisation.

  • @justmeandopensource

    @justmeandopensource

    3 жыл бұрын

    Hi, you can't change the name of the namespace. In other words, you can't rename a namespace. You have to create a new one and move resources into it and delete the old one.

  • @mmlmahesh

    @mmlmahesh

    3 жыл бұрын

    @@justmeandopensource can we ship the default name space resources and delete it?

  • @justmeandopensource

    @justmeandopensource

    3 жыл бұрын

    @@mmlmahesh You won't be able to delete the default namespace. Any resources you deploy without specifying the namespace will be deployed in the default namespace.

  • @mmlmahesh

    @mmlmahesh

    3 жыл бұрын

    @@justmeandopensource i was hoping to change the namespace name and change the context

  • @sumithsps007
    @sumithsps007 Жыл бұрын

    Could you please explain to me how I can connect to a cluster using a config file ?

  • @RajKumar-bl8yd
    @RajKumar-bl8yd5 жыл бұрын

    Hi, is it possible to create ingress reference service in different namespace

  • @justmeandopensource

    @justmeandopensource

    5 жыл бұрын

    Hi Raj, thanks for watching this video. You should be able to do it. I have done couple of videos on ingress controllers using Nginx and Traefik. Please search my channel for those videos. Might be helpful to you. But I haven't tested it across namespaces. But it should work. Thanks.

  • @caveman64ble
    @caveman64ble5 жыл бұрын

    If I wanted a user in demo only to have access to the demo context, and not get a result from kubectl get pods -n default, how would I achieve that?

  • @justmeandopensource

    @justmeandopensource

    5 жыл бұрын

    Hi John, Thanks for watching my video. You don't control access to contexts but to namespaces. So If I understand it correctly, you are asking how to restrict a user called demo to a namespace called demo. There is no user concept/object in Kubernetes. You can however use your existing identity service like LDAP or Active Directory and using hooks, achieve user implementation. And all the access is controlled by RBAC (Role Based Access Control). You can define what this account can and can't do using Roles, ClusterRoles, RoleBinding & ClusterRoleBinding. If you want an idea, I came across this article which explains what you need with examples. Full credit to the author. You can use that and extend it for your needs. Thanks, Venkat

  • @justmeandopensource

    @justmeandopensource

    5 жыл бұрын

    Forgot to paste the link. Here it is jeremievallee.com/2018/05/28/kubernetes-rbac-namespace-user.html

  • @narendrabhupathiraju8986
    @narendrabhupathiraju89864 жыл бұрын

    im using minikube , and I created new context and connected to that context , when im trying to kubectl get pods it asks for password, how can I resolve that

  • @justmeandopensource

    @justmeandopensource

    4 жыл бұрын

    Hi Narendra, thanks for watching this video. When you created a new context, did you specify a new user? You will need certificates created for the new user. Or are you using the same user account but different context for different namespace?

  • @gnadha123
    @gnadha1234 жыл бұрын

    Venkat, Any videos on RBAC ?

  • @justmeandopensource

    @justmeandopensource

    4 жыл бұрын

    Its there in my list but already done videos for the next two months. I will be doing it bur unfortunately it will be a long wait. Cheers

  • @gnadha123

    @gnadha123

    4 жыл бұрын

    @@justmeandopensource that's fine. If u release it earlier that would be help sine its most and first important task in production environment

  • @justmeandopensource

    @justmeandopensource

    4 жыл бұрын

    @@gnadha123 Yeah. I will see if I can record a video and post it between the schedule.

  • @nageshkampati4514
    @nageshkampati45145 жыл бұрын

    Is it possible to connect kubectl command to Windows systems You are doing without login into kmaster I will try the same way but it is not working Please help he how to set for Windows host machine as kubectl host

  • @justmeandopensource

    @justmeandopensource

    5 жыл бұрын

    Hi Nagesh, kubectl binary is available for all the OS. Please check the guide at kubernetes.io/docs/tasks/tools/install-kubectl/ to find out how to use it in Windows. It will be straight forward. You have to download kubectl update the path and copy the kube config to .kube folder under your user folder. Thanks, Venkat

  • @KhaleelShaik-vd5wj
    @KhaleelShaik-vd5wj4 жыл бұрын

    Hey Venkat, hope you are doing good...! Have u got time to work on my request . I.e multi tenant with different networks for each tenant

  • @justmeandopensource

    @justmeandopensource

    4 жыл бұрын

    hi Khaleel, thanks for watching. I need to explore that but I don't think that will be possible in a single cluster to have multiple overlay networks. If security is your concern then you can use pod security policies to isolate different tenants. Cheers.

  • @KhaleelShaik-vd5wj

    @KhaleelShaik-vd5wj

    4 жыл бұрын

    @@justmeandopensource thanks venkat, for your reply. Waiting for your video on these

  • @justmeandopensource

    @justmeandopensource

    4 жыл бұрын

    @@KhaleelShaik-vd5wj No worries.