简体   繁体   English

linkerd 用 helm 或命名空间注入?

[英]linkerd Inject with helm or namespace?

I can't seem to find a simple answer to my question,我似乎找不到我的问题的简单答案,

how to use linkerd inject command / options to add when using helm to install a package, eg like postgres?使用 helm 安装 package 时如何使用 linkerd inject 命令/选项添加,例如 postgres?

I have done it with another package but that was by adding the annotation command to a values file and supplying that when running the helm install command.我已经用另一个 package 完成了它,但那是通过将注释命令添加到值文件并在运行 helm install 命令时提供它。

With istio, all I have to do is to add a label on the namespace and it works?使用 istio,我所要做的就是在命名空间上添加一个 label 就可以了吗?

So I started to look into adding the annotation to the namespaces I am working with, using the kubectl create namespace command?所以我开始考虑使用kubectl create namespace命令将注解添加到我正在使用的命名空间中?

However, I cant seem to find a way to add any annotation at the point of creating a namespace, unless I use a file.但是,除非我使用文件,否则我似乎找不到在创建命名空间时添加任何注释的方法。

So, I either need a way to add this annotation to the namespace with the create command or when installing packages with helm?所以,我需要一种方法来使用 create 命令或在使用 helm 安装包时将此注释添加到名称空间?

Thanks,谢谢,

I think there are a couple of ways to do this.我认为有几种方法可以做到这一点。 It all depends on what you are trying to achieve and how you'd like to manage your underlying infrastructure.这完全取决于您要实现的目标以及您希望如何管理底层基础设施。

I assume you want to automate the installation of helm charts.我假设您想自动安装 helm charts。 If you are going to create the namespace using kubectl create namespace then you might be able to follow that up with kubectl annotate <created-namespace> "linkerd.io/inject=enabled" .如果您要使用kubectl create namespace ,那么您可以使用kubectl annotate <created-namespace> "linkerd.io/inject=enabled"进行跟进。

Alternatively, you can make use of the Linkerd CLI and use the inject command provided -- the workflow here would involve a combination of kubectl and linkerd commands so I'm not sure it's what you're looking for.或者,您可以使用Linkerd CLI并使用提供的 inject 命令——此处的工作流程将涉及kubectllinkerd命令的组合,因此我不确定它是否是您要寻找的。 N.netheless, you can do something like kubectl create namespace <my-namespace> -o yaml | linkerd inject - | kubectl apply -f - N.netheless,你可以做一些像kubectl create namespace <my-namespace> -o yaml | linkerd inject - | kubectl apply -f -这样的事情kubectl create namespace <my-namespace> -o yaml | linkerd inject - | kubectl apply -f - kubectl create namespace <my-namespace> -o yaml | linkerd inject - | kubectl apply -f - . kubectl create namespace <my-namespace> -o yaml | linkerd inject - | kubectl apply -f -

Last but not least, if you can use kubectl create namespace then you might be able to pipe the namespace manifest to kubectl directly and call it a day?最后但并非最不重要的一点是,如果您可以使用kubectl create namespace那么您可以将 pipe 命名空间清单直接发送到 kubectl 并收工? You can use something similar to the snippet below:您可以使用类似于以下代码片段的内容:

cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: Namespace
metadata:
  name: foo
  annotations:
    linkerd.io/inject: enabled
EOF

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM