I could not get around, how to inject Linkerd sidecar to a docker yaml file and save it to a different file name. 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:-
istioctl kube-inject -f deployment.yaml -o deployment-injected.yaml
linkerd inject
modifies resources to include the linkerd.io/inject: enabled
annotation. If you want to store this modified version, you can use simple shell redirection like:
:; 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.
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