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.
Everything useful I know about kubectl
81–90 of 90 posts
Re: Everything useful I know about kubectl
#82Something 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
Re: Everything useful I know about kubectl
#83One 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.…
Re: Everything useful I know about kubectl
#84Earlier 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…
Re: Everything useful I know about kubectl
#85Something 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
Re: Everything useful I know about kubectl
#86Earlier 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.
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
#87Something 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
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
#88Something 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
#89One 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.…
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\] $ '