portainer / k8s

How to deploy Portainer inside a Kubernetes environment.
MIT License
88 stars 58 forks source link

portainer-lb.yaml - cannot unmarshal object into Go struct field ClusterRoleBinding.subjects of type []v1.Subject #122

Open bubylou opened 1 year ago

bubylou commented 1 year ago

When setting up portainer on my k3s cluster using the provided command kubectl apply -n portainer -f https://downloads.portainer.io/ce2-16/portainer-lb.yaml I get an error saying Error from server (BadRequest): error when creating "portainer/portainer-account.yml": ClusterRoleBinding in version "v1" cannot be handled as a ClusterRoleBinding: json: cannot unmarshal object into Go struct field ClusterRoleBinding.subjects of type []v1.Subject. I found that in the ClusterRoleBinding under subjects was set as listed below.

subjects:
  kind: ServiceAccount
  namespace: portainer
  name: portainer-sa-clusteradmin

The issue is that these entries must be set like this instead.

subjects:
- kind: ServiceAccount
  namespace: portainer
  name: portainer-sa-clusteradmin

After changing it I was able to start up portainer and access my cluster environment. The repo looks to be correct so I'm guess that the files hosted on downloads.portainer.io are out of date. I did notice some white space issues and other formatting problems so I'll submit a PR to fix those. Hopefully that triggers a new build to be deployed to the download server.