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

11/1/2020
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/

-- ANKUSH KUMAR
istio
istio-kiali
istio-sidecar
kubernetes

1 Answer

11/9/2020

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::

-- Jakub
Source: StackOverflow