2 min read
Some commands might be safe to execute while connected to some environments, but can definitely break stuff is applied to the wrong Kubernetes cluster. However, having to execute kubectl config current-context too ofter to make sure we are connected to the right cluster is no fun either.
With kubectx tray we can have a small icon on the tray bar to help us identify what's the current cluster.
30/11/2022
Read more...1 min read
Since we can have several clusters configured we need to know to which cluster we are issues commands to, there are several ways we can do it with kubectl config:
03/11/2022
Read more...2 min read
Working with templates can be challenging since, at the end of the day, we are mixing two languages: The template language and the language on which the template itself is written. Doing so we are getting the complexity of one language in addition of the complexity of the other language. That's maybe the main reason why, sometimes, it can be challenging to spot a issues when templates are involved. For example, helm uses templates for generating the appropriate Kubernetes objects, this is one of the errors you might encounter:
$ helm template . --debug
install.go:172: [debug] Original chart version: ""
install.go:189: [debug] CHART PATH: /home/pet2cattle/git/spinnaker/helm-spinnaker
Error: template: spinnaker/templates/hooks/install-using-hal.yaml:15:28: executing "spinnaker/templates/hooks/install-using-hal.yaml" at <include (print $.Template.BasePath "/configmap/halyard-config.yaml") .>: error calling include: template: spinnaker/templates/configmap/halyard-config.yaml:120:54: executing "spinnaker/templates/configmap/halyard-config.yaml" at <.Values.serviceAccount.spinnaker.enable>: can't evaluate field Values in type interface {}
helm.go:81: [debug] template: spinnaker/templates/hooks/install-using-hal.yaml:15:28: executing "spinnaker/templates/hooks/install-using-hal.yaml" at <include (print $.Template.BasePath "/configmap/halyard-config.yaml") .>: error calling include: template: spinnaker/templates/configmap/halyard-config.yaml:120:54: executing "spinnaker/templates/configmap/halyard-config.yaml" at <.Values.serviceAccount.spinnaker.enable>: can't evaluate field Values in type interface {}
The error itself looks challenging at first glance, the lines that causes this message are the following:
{{- range $index, $context := .Values.kubeConfig.contexts }}
(...)
$HAL_COMMAND config provider kubernetes account $PROVIDER_COMMAND {{ $context }} --docker-registries dockerhub \
--context {{ $context }} {{ if .Values.serviceAccount.spinnaker.enable }}--service-account true{{ end }} \
(...)
{{- end }}
Can you spot the mistake?
02/04/2021
Read more...2 min read
On another post we talked about how to change kubernetes context using kubectl and there's another post for setting a default namespace for a given context. kubie is a tool that helps trying to make it easier
17/03/2021
Read more...2 min read
When you need to work on some specific namespace it is quite annoying yo have to specify at each kubectl command the same namespace over and over again. It's much easier to change the current context to use another namespace by default.
25/01/2021
Read more...