Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Permission issues when deploying sample provider from cluster-api book #741

Closed
pablochacin opened this issue Feb 11, 2019 · 6 comments
Closed
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/bug Categorizes issue or PR as related to a bug.
Milestone

Comments

@pablochacin
Copy link
Contributor

/kind bug

Hi I'm following the guide for creating a new cluster-api provider, and I'm getting the following error in the controller's log:

$> kubectl logs cluster-api-provider-solas-controller-manager-0 --namespace cluster-api-provider-solas-system -c manager
W0211 21:48:48.731633       1 controller.go:57] environment variable NODE_NAME is not set, this controller will not protect against deleting its own machine
{"level":"info","ts":1549921728.7322876,"logger":"kubebuilder.controller","msg":"Starting EventSource","controller":"machine-controller","source":"kind source: /, Kind="}
{"level":"info","ts":1549921728.7324562,"logger":"kubebuilder.controller","msg":"Starting EventSource","controller":"cluster-controller","source":"kind source: /, Kind="}
E0211 21:48:48.734469       1 reflector.go:134] sigs.k8s.io/controller-runtime/pkg/cache/internal/informers_map.go:126: Failed to list *v1alpha1.Machine: machines.cluster.k8s.io is forbidden: User "system:serviceaccount:cluster-api-provider-solas-system:default" cannot list resource "machines" in API group "cluster.k8s.io" at the cluster scope
E0211 21:48:48.734525       1 reflector.go:134] sigs.k8s.io/controller-runtime/pkg/cache/internal/informers_map.go:126: Failed to list *v1alpha1.Cluster: clusters.cluster.k8s.io is forbidden: User 

I suppose it has to do with the permissions set in `config/rbac_role.yaml'

apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  creationTimestamp: null
  name: manager-role
rules:
- apiGroups:
  - admissionregistration.k8s.io
  resources:
  - mutatingwebhookconfigurations
  - validatingwebhookconfigurations
  verbs:
  - get
  - list
  - watch
  - create
  - update
  - patch
  - delete
- apiGroups:
  - ""
  resources:
  - secrets
  verbs:

Environment:

  • Cluster-api version: 0.0.0-alpha.4
  • Kubernetes version: (use kubectl version): v1.13.2
  • OS (e.g. from /etc/os-release): OpenSUSE Leap 15.0
@k8s-ci-robot k8s-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Feb 11, 2019
@pablochacin
Copy link
Contributor Author

The solution to this issue is to add a patch for the ClusterRole defined in rbac_role.yaml, adding the missing rules, so that this is updated when generating the manifest:

Create config/default/rbac_cluster_api_patch.yaml

apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: manager-role
rules:
- apiGroups:
  - cluster.k8s.io
  resources:
  - clusters
  - clusters/status
  verbs:
  - get
  - list
  - watch
  - create
  - update
  - patch
  - delete
- apiGroups:
  - cluster.k8s.io
  resources:
  - machines
  - machines/status
  - machinedeployments
  - machinedeployments/status
  - machinesets
  - machinesets/status
  verbs:
  - get
  - list
  - watch
  - create
  - update
  - patch
  - delete

modify config/default/kustomization.yaml adding the following entry to patches

patches:
- rbac_cluster_api_patch.yaml

@pablochacin
Copy link
Contributor Author

pablochacin commented Feb 13, 2019

/assign @pablochacin

@pablochacin
Copy link
Contributor Author

I'm willing to fix this issue but need some help to know where in the documentation this new instructions should added.

/help

@k8s-ci-robot
Copy link
Contributor

@pablochacin:
This request has been marked as needing help from a contributor.

Please ensure the request meets the requirements listed here.

If this request no longer meets these requirements, the label can be removed
by commenting with the /remove-help command.

In response to this:

I'm willing to fix this issue but need some help to know where in the documentation this new instructions should added.

/help

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. label Feb 13, 2019
@vincepri
Copy link
Member

/cc @davidewatson
/milestone v1alpha1

@k8s-ci-robot k8s-ci-robot added this to the v1alpha1 milestone Feb 13, 2019
@detiber
Copy link
Member

detiber commented Feb 13, 2019

/assign @davidewatson
/priority important-soon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

No branches or pull requests

4 participants