Live data from Hacker News

Everything useful I know about kubectl

atomiccommits.io

81–90 of 90 posts

Re: Everything useful I know about kubectl

#81

Earlier quoted context omitted.

I'm lazy and I don't like having to remember "the right way" to run something, so my solution is directories and wrappers. I keep a directory for every environment (dev, stage, prod, etc) for every account I manage. env/ account-a/ dev/ stage/ prod/ account-b/ dev/ stage/ prod/ I keep config files in each directory. I call a wrapper script, cicd.sh , to run certain commands for me. When I want to deploy to stage in a…

I simply put my apps in different namespaces on dev/stage/prod/etc. That way a kubectl command run against the wrong cluster will fail naturally.

That's great idea. As long as you have that from the design , that's very cool. Moving existing infra to support the idea is just hard and quite a nightmare. In our new clusters, we apply that idea you've shared.

Re: Everything useful I know about kubectl

#82
post #75

Something this guide misses that is helpful about explain is that it can explain down to primaries types. “K explain po” is great, but “k explain po.spec” will give more details about the spec and its fields. This dot field pattern can go as deep as needed, like pod.spec.volumes.secret.items

omg TIL `k explain foo` and `k explain foo.spec` is a thing. thank you for this!!!

Re: Everything useful I know about kubectl

#83

One of the issues I've often seen that my team mates send "right command" to wrong cluster and context. We have a bunch of clusters and it's always surprising to see some laptop deployments on ... production cluster. So I wrote this https://github.com/icy/gk8s#seriously-why-dont-just-use-kube... It doesn't come with any autocompletion by default, but it's a robust way to deal with multiple clusters. Hope this helps.…

When I was running the internal k8s clusters at a previous workplace, I simply got into the habit of compulsively running `kubectl config current-context` to check which one of the 50+ clusters I was currently connected to (designated test clusters for *playing with cluster infra", designated clusters for "devs playing around", designated prod clusters, with segregation between "batch-like" and "interactive" workloads, as we needed to treat the nodes differently in those, designated "run the CI/CD pipelines" clusters, as they needed different RBAC, ... and then duplicate between multiple data centres).

Re: Everything useful I know about kubectl

#84
post #11

Earlier quoted context omitted.

That one has annoyed people for a long time. See https://github.com/kubernetes/kubernetes/issues/48388 . I'm pretty sure if you have the time to make a PR to fix it, it would be welcome. But I'm guessing it's non trivial or it would have been fixed by now - probably a quirk of the code generation logic.

> I'm pretty sure if you have the time to make a PR to fix it, it would be welcome. Google had a net income of $17.9 billion in just Q1 of 2021. I believe they have the resources to fix that, and I will not be shamed into "if you have time, please open a PR towards this opensource project". > But I'm guessing it's non trivial or it would have been fixed by now - probably a quirk of the code generation logic. I rememb…

Fortunately K8s is _not_ a Google owned project. It's managed by the CNCF which spans many different companies. Yes, there are a lot of Google people involved, but it really is a community project. Maybe I'm being naive but that's how I see it at least.

Re: Everything useful I know about kubectl

#85
post #75

Something this guide misses that is helpful about explain is that it can explain down to primaries types. “K explain po” is great, but “k explain po.spec” will give more details about the spec and its fields. This dot field pattern can go as deep as needed, like pod.spec.volumes.secret.items

Wait What

Re: Everything useful I know about kubectl

#86
post #84

Earlier quoted context omitted.

> I'm pretty sure if you have the time to make a PR to fix it, it would be welcome. Google had a net income of $17.9 billion in just Q1 of 2021. I believe they have the resources to fix that, and I will not be shamed into "if you have time, please open a PR towards this opensource project". > But I'm guessing it's non trivial or it would have been fixed by now - probably a quirk of the code generation logic. I rememb…

Fortunately K8s is _not_ a Google owned project. It's managed by the CNCF which spans many different companies. Yes, there are a lot of Google people involved, but it really is a community project. Maybe I'm being naive but that's how I see it at least.

> Fortunately K8s is _not_ a Google owned project. Yes, there are a lot of Google people involved, but it really is a community project.

It was created by Google and then "donated" to CNCF.

Conveniently, CNCF doesn't even list its members: https://www.cncf.io/about/members/

According to Wikipedia, though, "Founding members include Google, CoreOS, Mesosphere, Red Hat, Twitter, Huawei, Intel, Cisco, IBM, Docker, Univa, and VMware." [1]

Ah yes. I just love that free community spirit. Top 10-15 contributors are all paid money to work on this by Google, RedHat, Microsoft, VMWare, Goldman Sachs (and I couldn't bother to check others).

That is, 18 billion net income last quarter, 15 billion net income last quarter, 141 million net income last quarter, 6 billion last quarter...

These ginormous corps solve their own problems under the guise of open source, and gullible developers fall for the community promise.

[1] https://en.wikipedia.org/wiki/Cloud_Native_Computing_Foundat...

Re: Everything useful I know about kubectl

#87
post #75

Something this guide misses that is helpful about explain is that it can explain down to primaries types. “K explain po” is great, but “k explain po.spec” will give more details about the spec and its fields. This dot field pattern can go as deep as needed, like pod.spec.volumes.secret.items

Wait What

$ k explain -h

List the fields for supported resources

This command describes the fields associated with each supported API resource. Fields are identified via a simple JSONPath identifier:

  .[.]
  
 Add the --recursive flag to display all of the fields at once without descriptions. Information about each field is
retrieved from the server in OpenAPI format.

Use "kubectl api-resources" for a complete list of supported resources.

Examples: # Get the documentation of the resource and its fields kubectl explain pods

  # Get the documentation of a specific field of a resource
  kubectl explain pods.spec.containers
Options: --api-version='': Get different explanations for particular API version (API group/version) --recursive=false: Print the fields of fields (Currently only 1 level deep)

Usage: kubectl explain RESOURCE [options]

Use "kubectl options" for a list of global command-line options (applies to all commands).

$

Re: Everything useful I know about kubectl

#88
post #82
post #75

Something this guide misses that is helpful about explain is that it can explain down to primaries types. “K explain po” is great, but “k explain po.spec” will give more details about the spec and its fields. This dot field pattern can go as deep as needed, like pod.spec.volumes.secret.items

omg TIL `k explain foo` and `k explain foo.spec` is a thing. thank you for this!!!

I'm new to k8s and have found it useful. Hope it helps you too.

Re: Everything useful I know about kubectl

#89

One of the issues I've often seen that my team mates send "right command" to wrong cluster and context. We have a bunch of clusters and it's always surprising to see some laptop deployments on ... production cluster. So I wrote this https://github.com/icy/gk8s#seriously-why-dont-just-use-kube... It doesn't come with any autocompletion by default, but it's a robust way to deal with multiple clusters. Hope this helps.…

Every member of our ops team has the following PS1 var in .bashrc to prevent such accidents:

  PS1='\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]\[\033[01;33m\] [`kubectl config current-context| rev | cut -d_ -f1 | rev`] \[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\] $ '

Re: Everything useful I know about kubectl

#90
I'm Tonia Anderson by name, I am from the States, Suffolk county to be precise. I am here today to testify of the good works LORD ZAKUZA has done in my life, I never knew great men still exist until I found him. I have been suffering from heart break for the past 3 years, my partner who I invested on cheated on me with my best friend on my matrimonial bed, I was yet to recover from this terrible shock and needed help to make him stop cheating. A friend of mine directed me to this spell caster called Lord Zakuza. I doubted him at first but as things went further, I had to give him my trust and I did exactly what he told me to do. Ever since then, I have been happy all my life and my love life with my partner has been so wonderful and all this happened within 48 hours of contacting Lord Zakuza.. You can also need his help for anything and here's his contact information's. Email: lordzakuza7 @ gmail. com and Website: lordzakuzaspells.com or Call/text/WhatsApp +1 (740) 573-9483.
Post reply on HN