Home > Software design >  How to override external yaml applied to K8S?
How to override external yaml applied to K8S?

Time:09-14

I am trying to set up kubemq in my cluster, and this is the command the shown in their README

kubectl apply -f https://deploy.kubemq.io/community

There are a lot of empty field in that yaml and I want to customize it. How can I override an external yaml file applied by kubectl?

CodePudding user response:

In the Kubernetes world, It's generally an unsafe idea to run a command like the below unless you trust the URL:

kubectl apply -f <some/web/url>

This is essentially the same as the following in the non-Kubernetes world:

curl </some/web/url> |bash

In both cases, we aren't inspecting the content downloaded from the URL and directly executing them by feeding to kubectl and bash directly. What if the URL is compromised with some harmful code?

A better approach is to break the single step into parts:

  1. Download the manifest file
  2. Inspect the manifest file.
  3. Run kubectl apply/create on it, only you are satisfied.

Example:
//download the file

curl -fsSL -o downloaded.yml https://deploy.kubemq.io/community

// inspect the file or edit the file

//Now apply the downloaded file after inspecting.

kubectl apply -f downloaded.yml

CodePudding user response:

Why don't you just copy the content in a text file? Change whatever you want and apply it.

  • Related