istio: bug: failed to copy /opt/cni/bin/istio-cni - permission denied

Is this the right place to submit this?

  • This is not a security vulnerability or a crashing bug
  • This is not a question about how to use Istio

Bug Description

On installing the istio/cni helm chart version 1.24.0 in a kubespray cluster with calico (tigera-operator), istio-cni failes with the following error:

2024-11-10T04:30:59.448881Z     error   cni-agent       failed file copy of /opt/cni/bin/istio-cni to /host/opt/cni/bin: open /host/opt/cni/bin/istio-cni.tmp.4013640219: permission denied
2024-11-10T04:30:59.448969Z     error   cni-agent       installer failed: copy binaries: open /host/opt/cni/bin/istio-cni.tmp.4013640219: permission denied

istio/base 1.24.0 is also installed (without issue).

Version

$ istioctl version
Istio is not present in the cluster: no running Istio pods in namespace "istio-system"
client version: 1.23.2
$ kubectl version
Client Version: v1.31.2
Kustomize Version: v5.4.2
Server Version: v1.30.4

Additional Information

Full pod logs:

2024-11-10T04:30:59.344166Z     info    cni-agent       CNI logging level: info
2024-11-10T04:30:59.344141Z     info    ControlZ available at 127.0.0.1:9876
2024-11-10T04:30:59.344247Z     info    cni-agent       CNI install configuration:
MountedCNINetDir: /host/etc/cni/net.d
CNIConfName:
ChainedCNIPlugin: true
CNIAgentRunDir: /var/run/istio-cni
PluginLogLevel: info
KubeconfigMode: 0600
KubeCAFile:
SkipTLSVerify: false
ExcludeNamespaces:
K8sServiceProtocol:
K8sServiceHost: 10.104.0.1
K8sServicePort: 443
K8sNodeName: istio-cni-node-cs6qd
CNIBinSourceDir: /opt/cni/bin
CNIBinTargetDirs: /host/opt/cni/bin
MonitoringPort: 15014
ZtunnelUDSAddress: /var/run/ztunnel/ztunnel.sock
AmbientEnabled: false
AmbientDNSCapture: false
AmbientIPv6: true
AmbientRedirectTPROXY: false

2024-11-10T04:30:59.344264Z     info    cni-agent       CNI race repair configuration:
Enabled: true
NodeName: rk01.turing.home.arpa
LabelKey: cni.istio.io/uninitialized
LabelValue: true
DeletePods: false
LabelPods: false
SidecarAnnotation: sidecar.istio.io/status
InitContainerName: istio-validation
InitTerminationMsg:
InitExitCode: 126
LabelSelectors:
FieldSelectors:

2024-11-10T04:30:59.345135Z     info    cni-agent       starting CNI sidecar repair controller
2024-11-10T04:30:59.347253Z     info    cluster "" kube client started
2024-11-10T04:30:59.379178Z     info    controllers     starting        controller=repair pods
2024-11-10T04:30:59.448454Z     info    cni-agent       initialization complete, watching node CNI dir
2024-11-10T04:30:59.448881Z     error   cni-agent       failed file copy of /opt/cni/bin/istio-cni to /host/opt/cni/bin: open /host/opt/cni/bin/istio-cni.tmp.4013640219: permission denied
2024-11-10T04:30:59.448969Z     error   cni-agent       installer failed: copy binaries: open /host/opt/cni/bin/istio-cni.tmp.4013640219: permission denied
2024-11-10T04:30:59.448976Z     info    cni-agent       cleaning up CNI installation
Error: copy binaries: open /host/opt/cni/bin/istio-cni.tmp.4013640219: permission denied

/opt/cni/bin on host after kubespray install (no calico or istio):

ubuntu@rk01:~$ ls -nlah /opt/cni/bin/
total 77M
drwxr-xr-x 2 995 0 4.0K Dec  4  2023 .
drwxr-xr-x 3 995 0 4.0K Nov 10 02:32 ..
-rwxr-xr-x 1 995 0 3.9M Dec  4  2023 bandwidth
-rwxr-xr-x 1 995 0 4.4M Dec  4  2023 bridge
-rwxr-xr-x 1 995 0  11M Dec  4  2023 dhcp
-rwxr-xr-x 1 995 0 4.1M Dec  4  2023 dummy
-rwxr-xr-x 1 995 0 4.5M Dec  4  2023 firewall
-rwxr-xr-x 1 995 0 4.0M Dec  4  2023 host-device
-rwxr-xr-x 1 995 0 3.4M Dec  4  2023 host-local
-rwxr-xr-x 1 995 0 4.1M Dec  4  2023 ipvlan
-rwxr-xr-x 1 995 0 3.5M Dec  4  2023 loopback
-rwxr-xr-x 1 995 0 4.1M Dec  4  2023 macvlan
-rwxr-xr-x 1 995 0 3.9M Dec  4  2023 portmap
-rwxr-xr-x 1 995 0 4.3M Dec  4  2023 ptp
-rwxr-xr-x 1 995 0 3.7M Dec  4  2023 sbr
-rwxr-xr-x 1 995 0 3.1M Dec  4  2023 static
-rwxr-xr-x 1 995 0 4.2M Dec  4  2023 tap
-rwxr-xr-x 1 995 0 3.6M Dec  4  2023 tuning
-rwxr-xr-x 1 995 0 4.1M Dec  4  2023 vlan
-rwxr-xr-x 1 995 0 3.9M Dec  4  2023 vrf

uid 995 is from kubespray:

ubuntu@rk01:~$ id 995
uid=995(kube) gid=988(kube-cert) groups=988(kube-cert)

/opt/cni/bin on host after calico install:

ubuntu@rk01:~$ ls -nlah /opt/cni/bin/
total 206M
drwxr-xr-x 2 995 0 4.0K Nov 10 03:35 .
drwxr-xr-x 3 995 0 4.0K Nov 10 02:32 ..
-rwxr-xr-x 1   0 0 4.2M Nov 10 03:35 bandwidth
-rwxr-xr-x 1 995 0 4.4M Dec  4  2023 bridge
-rwxr-xr-x 1   0 0  63M Nov 10 03:35 calico
-rwxr-xr-x 1   0 0  63M Nov 10 03:35 calico-ipam
-rwxr-xr-x 1 995 0  11M Dec  4  2023 dhcp
-rwxr-xr-x 1 995 0 4.1M Dec  4  2023 dummy
-rwxr-xr-x 1 995 0 4.5M Dec  4  2023 firewall
-rwxr-xr-x 1   0 0 2.7M Nov 10 03:35 flannel
-rwxr-xr-x 1 995 0 4.0M Dec  4  2023 host-device
-rwxr-xr-x 1   0 0 3.8M Nov 10 03:35 host-local
-rwxr-xr-x 1 995 0 4.1M Dec  4  2023 ipvlan
-rwxr-xr-x 1   0 0 3.8M Nov 10 03:35 loopback
-rwxr-xr-x 1 995 0 4.1M Dec  4  2023 macvlan
-rwxr-xr-x 1   0 0 4.3M Nov 10 03:35 portmap
-rwxr-xr-x 1 995 0 4.3M Dec  4  2023 ptp
-rwxr-xr-x 1 995 0 3.7M Dec  4  2023 sbr
-rwxr-xr-x 1 995 0 3.1M Dec  4  2023 static
-rwxr-xr-x 1 995 0 4.2M Dec  4  2023 tap
-rwxr-xr-x 1   0 0 4.0M Nov 10 03:35 tuning
-rwxr-xr-x 1 995 0 4.1M Dec  4  2023 vlan
-rwxr-xr-x 1 995 0 3.9M Dec  4  2023 vrf

istioctl bug-report output: bug-report.tar.gz

$ istioctl bug-report

Target cluster context: kubernetes-admin-turing@turing

Running with the following config:

istio-namespace: istio-system
full-secrets: false
timeout (mins): 30
include: {  }
exclude: { Namespaces: kube-node-lease,kube-public,kube-system,local-path-storage }
end-time: 2024-11-09 23:37:57.479241884 -0500 EST



Cluster endpoint: https://rk01.turing.home.arpa:6443
CLI version:
version.BuildInfo{Version:"1.23.2", GitRevision:"Homebrew", GolangVersion:"go1.23.1", BuildStatus:"Homebrew", GitTag:"1.23.2"}

The following Istio control plane revisions/versions were found in the cluster:
The following proxy revisions/versions were found in the cluster:


Fetching logs for the following containers:

calico-apiserver/calico-apiserver/calico-apiserver-56f4d85c9d-2bwfv/calico-apiserver
calico-apiserver/calico-apiserver/calico-apiserver-56f4d85c9d-488sc/calico-apiserver
calico-apiserver/calico-apiserver/calico-apiserver-56f4d85c9d-57v56/calico-apiserver
calico-system/calico-kube-controllers/calico-kube-controllers-5b49d76f6c-mcvxp/calico-kube-controllers
calico-system/calico-node/calico-node-5sbww/calico-node
calico-system/calico-node/calico-node-7hcs6/calico-node
calico-system/calico-node/calico-node-cbff7/calico-node
calico-system/calico-node/calico-node-vjrqv/calico-node
calico-system/calico-typha/calico-typha-8559956cf4-4rj8h/calico-typha
calico-system/calico-typha/calico-typha-8559956cf4-g4hjx/calico-typha
calico-system/csi-node-driver/csi-node-driver-4mhpd/calico-csi
calico-system/csi-node-driver/csi-node-driver-4mhpd/csi-node-driver-registrar
calico-system/csi-node-driver/csi-node-driver-5bs4g/calico-csi
calico-system/csi-node-driver/csi-node-driver-5bs4g/csi-node-driver-registrar
calico-system/csi-node-driver/csi-node-driver-dqqvm/calico-csi
calico-system/csi-node-driver/csi-node-driver-dqqvm/csi-node-driver-registrar
calico-system/csi-node-driver/csi-node-driver-t8wrx/calico-csi
calico-system/csi-node-driver/csi-node-driver-t8wrx/csi-node-driver-registrar
istio-system/istio-cni-node/istio-cni-node-bn6nc/install-cni
istio-system/istio-cni-node/istio-cni-node-bnfjr/install-cni
istio-system/istio-cni-node/istio-cni-node-cs6qd/install-cni
istio-system/istio-cni-node/istio-cni-node-x7nnk/install-cni
tigera-operator/tigera-operator/tigera-operator-69b849477d-tprvp/tigera-operator

Fetching Istio control plane information from cluster.


Fetching CNI logs from cluster.

Running Istio analyze on all namespaces and report as below:
Analysis Report:
Info [IST0102] (Namespace calico-apiserver) The namespace is not enabled for Istio injection. Run 'kubectl label namespace calico-apiserver istio-injection=enabled' to enable it, or 'kubectl label namespace calico-apiserver istio-injection=disabled' to explicitly mark it as not needing injection.
Info [IST0102] (Namespace calico-system) The namespace is not enabled for Istio injection. Run 'kubectl label namespace calico-system istio-injection=enabled' to enable it, or 'kubectl label namespace calico-system istio-injection=disabled' to explicitly mark it as not needing injection.
Info [IST0102] (Namespace default) The namespace is not enabled for Istio injection. Run 'kubectl label namespace default istio-injection=enabled' to enable it, or 'kubectl label namespace default istio-injection=disabled' to explicitly mark it as not needing injection.
Info [IST0102] (Namespace kube-node-lease) The namespace is not enabled for Istio injection. Run 'kubectl label namespace kube-node-lease istio-injection=enabled' to enable it, or 'kubectl label namespace kube-node-lease istio-injection=disabled' to explicitly mark it as not needing injection.
Info [IST0102] (Namespace kube-public) The namespace is not enabled for Istio injection. Run 'kubectl label namespace kube-public istio-injection=enabled' to enable it, or 'kubectl label namespace kube-public istio-injection=disabled' to explicitly mark it as not needing injection.
Info [IST0102] (Namespace kube-system) The namespace is not enabled for Istio injection. Run 'kubectl label namespace kube-system istio-injection=enabled' to enable it, or 'kubectl label namespace kube-system istio-injection=disabled' to explicitly mark it as not needing injection.
Info [IST0102] (Namespace monitoring) The namespace is not enabled for Istio injection. Run 'kubectl label namespace monitoring istio-injection=enabled' to enable it, or 'kubectl label namespace monitoring istio-injection=disabled' to explicitly mark it as not needing injection.
Info [IST0102] (Namespace tigera-operator) The namespace is not enabled for Istio injection. Run 'kubectl label namespace tigera-operator istio-injection=enabled' to enable it, or 'kubectl label namespace tigera-operator istio-injection=disabled' to explicitly mark it as not needing injection.
Info [IST0118] (Service calico-apiserver/calico-api) Port name apiserver (port: 443, targetPort: 5443) doesn't follow the naming convention of Istio port.
Info [IST0118] (Service calico-system/calico-kube-controllers-metrics) Port name metrics-port (port: 9094, targetPort: 9094) doesn't follow the naming convention of Istio port.
Info [IST0118] (Service calico-system/calico-typha) Port name calico-typha (port: 5473, targetPort: calico-typha) doesn't follow the naming convention of Istio port.
Info [IST0118] (Service kube-system/coredns) Port name metrics (port: 9153, targetPort: 9153) doesn't follow the naming convention of Istio port.
Creating an archive at /home/gclawes/repos/github.com/gclawes/homelab/ansible/bug-report.tar.gz.
Time used for creating the tar file is 99.092234ms.
Cleaning up temporary files in /tmp/bug-report.
Done.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 22 (11 by maintainers)

Commits related to this issue

Most upvoted comments

This has already been fixed/improved in the 1.25 docs with the gke platform profile.

We really need a specific “here is how to generate templates from the charts” page, which we’ve never had for helm, having gotchas for 3 different install mechanisms on every page isn’t going to work.

This used to be better documented, I think there was an accidental removal of the docs: istio/istio.io#16056

@howardjohn Thanks the change worked image

istioctl manifest generate \
  --set values.defaultRevision=default \
  --set profile=ambient \
  --set values.cni.cniBinDir=/home/kubernetes/bin \
  > /Users/mac/ambient.yml
$ kubectl -n istio-system get pod/istio-cni-node-8qkgl -o jsonpath='{.spec.containers[0].securityContext}' | jq
{
  "appArmorProfile": {
    "type": "Unconfined"
  },
  "capabilities": {
    "add": [
      "NET_ADMIN",
      "NET_RAW",
      "SYS_PTRACE",
      "SYS_ADMIN"
    ],
    "drop": [
      "ALL"
    ]
  },
  "privileged": false,
  "runAsGroup": 0,
  "runAsNonRoot": false,
  "runAsUser": 0
}

Still seeing this in v1.24.1. bug-report.tar.gz attached.

$ kubectl -n istio-system get pod/istio-cni-node-8qkgl -o jsonpath='{.spec.containers[0].image}'
docker.io/istio/install-cni:1.24.1-distroless
$ kubectl -n istio-system logs istio-cni-node-8qkgl | tail -5
2024-11-
26T19:32:26.107297Z	info	Running command (without lock): iptables-nft -t nat -X ISTIO_POSTRT
2024-11-26T19:32:26.109408Z	info	Running command (without lock): ip6tables-nft -t nat -D POSTROUTING -j ISTIO_POSTRT
2024-11-26T19:32:26.163498Z	info	Running command (without lock): ip6tables-nft -t nat -F ISTIO_POSTRT
2024-11-26T19:32:26.169914Z	info	Running command (without lock): ip6tables-nft -t nat -X ISTIO_POSTRT
Error: copy binaries: open /host/opt/cni/bin/istio-cni.tmp.4135601843: permission denied

We believe this is fixed in https://github.com/istio/istio/pull/53888 which will be included in 1.24.1 later this week (hopefully). Thanks everyone