 Hi, myself, Suresh. That's me. So I work at Red Hat. I work on a tool known as Odo, which helps developer to work with OpenShift. Apart from that, I'm a CNSIP ambassador and organizes the Bangalore Kubernetes Meetup. So if you're around Bangalore, let me know. Yeah. So I'm going to talk about CubeCTL, which is a Kubernetes CLI. So I assume all of you are familiar with the Kubernetes and its CLI CubeCTL. So it's the disclaimer. There's no rocket science as the talk title is. So yeah, let's start. So before that, recently community, Ashley McNamara from community has created a nice logo for the CubeCTL. So that's the logo for CubeCTL. Then, yeah, so how do you guys read CubeCTL? So just shout out if you have any different pronunciation or something. Okay, anything else? Okay. So yeah, some people call it as CubeCTL, CubeControl, CubeCuttle, CubeCuttle. So yeah, different, different pronunciation for the same. So yeah, so pre-flight, I mean, when you start. So that's something known as autocompletion with the CubeCTL. So if you add this line into your BASA-C, it helps you to autocompletion, which kind of increase your productivity while working with Kubernetes. So like, and yeah, if you have ZSH, there's also a support for ZSH also, you just need to add this line. So this autocompletion works for the verb. So verb that means like CubeCTL get create anything. Also, it works for the resources also, let's say CubeCTL get parts, deployments or whatever. And also it works for the flag. So it is like one of the cool stuff which which increases your speed while working with Kubernetes. Yeah, so that's about autocompletion stuff. Then next is editor. I mean, if if you add this line into your BASA-C, it helps you to have your own editor. I mean, let's say you are editing something or you are you want to edit some YAML with the help of CubeCTL. Let's say I wrote here, G-Edit, you can write Emacs, WIM code, whatever you want. So it's it's kind of useful and much helpful when you work. So next is about alias. So all the things that I'm going to talk about, it's all a suggestions which helps you to work more better with Kubernetes. So that's alias. So I'm not suggesting you go with this alias, but those are some common aliases which helps. I mean, when you set, let's say K with CubeCTL, it's easy to type K get parts like that. And Ahmed from the Kubernetes community has wrote a nice blog on CubeCTL aliases. And he also has a nice project with generate around 600 aliases which helps while working. Next is about PS1. So PS1 is this nice line in the terminal which helps. So like this. So I have my cluster IP and my namespace along with my PS1. So it helps when you work with the multiple clusters. So it's my PS1, something like this, but you can create your own also. So there's some cool project known as QPS1. You can use this project to set some fancy PS1 for you. It helps. I mean, rather than just going to just look at like CubeCTL config view just to see which cluster you are on or which namespace you're on, you can just set this. And now all the BASRC stuff are done. You are ready to work. Then next hack is about, let's say, there's some resource and you want to know something about some resource. Rather than going to the doc, let's say, in a previous days in the Linux, we used to have a man pages. So similarly, you don't need to go to documentation. You can just do explain. So let's say CubeCTL explain. So you can do CubeCTL explain pod, deployment, spec, anything. So maybe I can quickly show you how that works. So let's say you want to see what all the keys are there in the pod. You can just do explain on the pod. Maybe you want to see, let's say, what's there in the pod spec. You can check with all the descriptions also. So it's very helpful when you don't know some key or something. You can go and read from the same terminal. You don't need to go to documentation for this. And thus, this is very helpful when you know the key, but you forgot, I mean, you know the resource, but you forgot something and you just need that key. So what you can do is you can do CubeCTL explain pod and let's say recursive. And you get just the list, I mean, which keys there and let's say if you go for spec, what all the fields are there inside the spec, whether they are list or just object or string or whatever. I mean, it's very helpful. Personally, I found it very useful to find some key. So yeah, that's about resource. Then there's a nice feature also DryRun. If you're familiar with Ansible, Ansible also has something similar as DryRun. So DryRun is like if you are creating something and you're not sure about whether your YAML is correct or maybe you're not sure that you're creating the right resource, you can just have a DryRun. It will not deploy anything, it will just, virtually it will try to do something and you can be sure about it. I mean, okay, so I can create this object. So for example, so let's say if I'm trying to create a config map, if I give up flag DryRun, it just say it created and DryRun. That means whatever command I run was correct. Also one of the advantage of DryRun is you just provide hyphen of flag and you get the YAML for the same, which is like you can export and maybe store it somewhere. Next is about edit while you create. It's also one of the useful commands. So let's say for example, you have some file or a URL, you can like simply while creating, you can simply provide this flag and it opens editor and you can, let's say, edit and save it and it will, it will deploy that new changes. So I already have that part, so it's a, it gives me an error but it also, it is also a useful flag because you have some file, you don't want to make change to that file but while deploying, you want some changes to try out some, to debug. So this flag is very useful. Next is copy. So I have seen some people, what they do is like, okay, so they will take a SSH access of that container and they will download something, even if they have file on their machine. So instead of that, you can just use kubectlcp. It's very similar to what CP or like R sync or something. It's very similar to that. So it is also useful while you are developing something or you are working on some application. And yeah, so this was all about like a normal commands and let's talk about a bit kubconfig. So kubconfig is a configuration file which contains all the information talked to a specific cluster. So those are the precedents of the flag where let's say you provide a hyphen hyphen kubconfig flag, maybe the kubconfig environment variable or maybe the default kubconfig file inside your .kub directory. So let's say you still have this file in your home directory but if you have some random cluster, you want to just try out, you provide with the flag. It has a first preference. So you can do that. Next is about porting the kubconfig. So let's say you have some cluster and you want to give access to someone and so for that you need to port your kubconfig file. So how you can do that? So let's say for example, you have a sample kubconfig file here which has let's say all certificates client, cert and key path are there. All the contacts are there. But those certs and the key are present on my machine, not on the next person machine. So what I can do is kubconfig view. So that's something known as flatten. So I'll show you what flatten does. So it takes that certificate or key or whatever, it just dump into that file and it gives you this file. So you just redirect this output into some file and you can like easily port your kubconfig and give it to someone to access your cluster. And so this one nice flag known as minify. So the title is just the current context. That means let's say you have a multiple clusters with a multiple namespace, but you just want to provide the current namespace and the let's say current cluster. So along with the flatten, you just provide this minify flag. It just provide the current context. So that you just provide the one cluster while porting the kubconfig. Then there's one cool thing about kubconfig. It's not well known also that if you have a multiple clusters with a multiple kubconfig file, but you want to use all those things at once, you can just export a variable like this. Just kubconfig 1 colon kubconfig 2 and your kubctl knows the both kubconfig now and it can work accordingly. So that's about it. I mean two kubconfig if you have. Let's say you're not okay with it. So what you can do is you can do the same thing with this command kubctl config view and just this flag merge which merges the both kubconfig file and set the right context. And then you have a new kubconfig file which you can give it to someone or maybe you can use yourself. So this is about kubconfig. So again the Ahmed guy from Kubernetes community has wrote a nice blog about mastering kubconfig. It also has nice things, nice tricks about kubconfig, how you can deal with it. So next level, I mean so we're done with the Basasi with our basic stuff. Then we saw some nice commands which can help us. So let's go to next level. So next level is accessing Kubernetes API. So usually what people do is they'll do something like kubctl proxy and then they will go and access the API but instead of that you can just do kubctl getraw and you can access it. So let's say kubctl getraw slash. So you can access all the APIs here. Let's say you can do api slash v1. So maybe you want to debug something or maybe you want to see something from the YAML. So you can use this raw function. I found it very useful while taking some API parts or something. So next is about logging while running some commands. I found those log level very useful. For example v9 gives you the curl command which you can use, v8 gives you the request and response body and v6 gives you the method and API path. So let's say for example, so I have this nginx1 pod. If I do v6, it gives me the path. So let's say this path. Now I can use this same path with hyphen hyphen raw also to retrieve the JSON and to play around it. So let's say for example and similarly if you see v8, you get the request headers, response body, everything. It is much useful for the debugging purpose when you are developing some tooling around Kubernetes. So it is very useful there. And next one is crue. So the thing is to add your own stuff, people used to write some their own shell script, some own Golang code or something to have their own hack around Kubernetes. So the community added this new tool known as crue. So crue is basically a package manager for the plugin. So it's very similar. You can just do crue search. You can search from all the plugins by the community or maybe you can create your own also. So it's very simple. You just do install this plugin. It's very simple. Search it and install the plugin and you are ready to use. Let's say cube ctl xyz and let's say you want to, like once you have a crue installed on your machine, what you can do is if you have your own shell script or any script which talks to Kubernetes cluster, any hack, just rename it to cube ctl hyphen let's say xyz and put it in your path and you are ready to use just like cube ctl xyz. So I created for myself which is cube ctl status. So I work around OpenShift mainly. So OpenShift has this command known as OC status, but so I'm much familiar with that. So I created my own which is a cube ctl status. So I can check, let's say, cube ctl status. Currently it just shows the deployment for me. So it's very similar to how OC status works with OpenShift. So anyone can create their own sub command for this cube ctl. So and the last is output. If you want the output in a nice format you can, there are like n number of options we can go through. Usually we are just familiar with JSON and YAML, but there are much more greater formats like JSON path or maybe custom columns you can use. So that's a nice collection of all those output hacks are there at this link by Vincent Dismit. So Vincent Dismit is an organizer for Kubernetes met up here in Bangalore, sorry, in Singapore. And if you need more help, there are like a bunch of tools. Mainly I found this very interesting, cube ctl, but there are n number of tools on the internet. You can search for it. So I guess that's it for my talk. So if you need this slide, if you find it useful, so I created this nice URL just redirects to this slide. It's very simple for satiate2019.sourage.pro. So yeah, if you need slide just go to this URL. Thank you. And if you want to talk about Kubernetes or maybe anything about it, I'm around in the exhibition hall. If you don't find me, that's my Twitter and LinkedIn, you can just ping me there. Thank you. I've been scheduled for Q&A, so if there are any questions, any questions? Okay. I won't excuse to throw the microphone. Nope. Oh, come on. Nobody uses Kubernetes. We're in a cloud session and no one has questions about cube ctl. Okay. Yeah, if you have anything to talk around Kubernetes, I'm around. Catch me, we'll talk. Yeah. Thanks a lot. Many thanks.