简体   繁体   English

Linkerd sidecar 注入

[英]Linkerd sidecar Injection

I could not get around, how to inject Linkerd sidecar to a docker yaml file and save it to a different file name.我无法绕过,如何将 Linkerd sidecar 注入 docker yaml 文件并将其保存为不同的文件名。 Honestly i have tried to go through linkerd docs but could not really get the idea.老实说,我试图通过链接器文档,但无法真正理解这个想法。 Following commands did not help me to understand:-以下命令没有帮助我理解:-

# Inject all the deployments in the default namespace.
kubectl get deploy -o yaml | linkerd inject - | kubectl apply -f -

# Injecting a file from a remote URL
linkerd inject http://url.to/yml | kubectl apply -f -

# Inject all the resources inside a folder and its sub-folders.
linkerd inject <folder> | kubectl apply -f -

I want to inject linkerd sidecar to a docker yaml like following command, which helps me to inject istio sidecar to a docker yaml file and save it in different file name:-我想像以下命令一样将 linkerd sidecar 注入到 docker yaml,这有助于我将 istio sidecar 注入到 docker yaml 文件中并将其保存为不同的文件名:-

istioctl kube-inject -f deployment.yaml -o deployment-injected.yaml

linkerd inject modifies resources to include the linkerd.io/inject: enabled annotation. linkerd inject修改资源以包含linkerd.io/inject: enabled注释。 If you want to store this modified version, you can use simple shell redirection like:如果要存储此修改后的版本,可以使用简单的 shell 重定向,例如:

:; linkerd inject deploy.yml >deploy-annotated.yml

namespace "myns" injected
service "mysvc" skipped
deployment "mydeploy" injected
:; diff deploy.yml deploy-annotated.yml
17a18,19
>   annotations:
>     linkerd.io/inject: enabled
72a75,76
>       annotations:
>         linkerd.io/inject: enabled

This uses Linkerd's proxy-injector admission controller to add sidecar containers at pod-creation time.这使用 Linkerd 的代理注入器准入控制器在创建 pod 时添加边车容器。

Alternatively, you can "manually" inject the proxy locally, though this is generally discouraged, since it prevents your application from automatically getting new proxy versions & configuration.或者,您可以在本地“手动”注入代理,尽管通常不鼓励这样做,因为它会阻止您的应用程序自动获取新的代理版本和配置。 Also, the generated configuration is much larger:此外,生成的配置要大得多:

:; linkerd inject --manual deploy.yml >deploy-manual.yml

namespace "myns" injected
service "mysvc" skipped
deployment "mydeploy" injected
:; du -sh deploy.yml deploy-manual.yml
4.0K    deploy.yml
8.0K    deploy-manual.yml

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

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