3
istioctl kube-inject \
--injectConfigFile inject-config.yaml \
--meshConfigFile mesh-config.yaml \
--valuesFile inject-values.yaml \
--filename samples/sleep/sleep.yaml \
| kubectl apply -f -

While trying to inject istio sidecar container manually to pod. I got error -

Error: template: inject:469: function "appendMultusNetwork" not defined

https://istio.io/latest/docs/setup/additional-setup/sidecar-injection/

  • What is your istio version? Have you changed anything in above configs? I have tried that example from documentation on my test cluster with istio 1.7.3 and everything worked just fine. – Jakub Nov 02 '20 at 08:01

1 Answers1

1

As mentioned in comments I have tried to reproduce your issue on gke with istio 1.7.4 installed.

I've followed the documentation you mentioned and it worked without any issues.


1.Install istioctl and istio default profile

curl -sL https://istio.io/downloadIstioctl | sh -
export PATH=$PATH:$HOME/.istioctl/bin
istioctl install

2.Create samples/sleep directory and create sleep.yaml, for example with vi.

3.Create local copies of the configuration.

kubectl -n istio-system get configmap istio-sidecar-injector -o=jsonpath='{.data.config}' > inject-config.yaml
kubectl -n istio-system get configmap istio-sidecar-injector -o=jsonpath='{.data.values}' > inject-values.yaml
kubectl -n istio-system get configmap istio -o=jsonpath='{.data.mesh}' > mesh-config.yaml

4.Apply it with istioctl kube-inject

istioctl kube-inject \
    --injectConfigFile inject-config.yaml \
    --meshConfigFile mesh-config.yaml \
    --valuesFile inject-values.yaml \
    --filename samples/sleep/sleep.yaml \
    | kubectl apply -f -

5.Verify that the sidecar has been injected

kubectl get pods
NAME                     READY   STATUS    RESTARTS   AGE
sleep-5768c96874-m65bg   2/2     Running   0          105s

So there are few things worth to check as it might might cause this issue::

  • Could you please check if you executed all your commands correctly?
  • Maybe you run older version of istio and you should follow older documentation?
  • Maybe you changed something in above local copies of the configuration and that cause the issue? If you did what exactly did you change?
Jakub
  • 8,189
  • 1
  • 17
  • 31