简体   繁体   中英

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?

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.

With istio, all I have to do is to add a label on the namespace and it works?

So I started to look into adding the annotation to the namespaces I am working with, using the kubectl create namespace command?

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?

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. 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" .

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. N.netheless, you can do something like 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? 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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