Unable to run manifest file in kubernetes with jenkins user

Viewed 27

I have used ansible to create my k8s cluster on ubuntu machine and made ubuntu user passwordless to do so.

I am unable to run manifest file in my kubernetes cluster with jenkins user and getting error.

[Pipeline] sh

  • kubectl apply -f deployment.yml -f service.yml Error from server (Forbidden): window.location.replace('/login?from=%2Fswagger-2.0.0.pb-v1%3Ftimeout%3D32s');

I tried to add below rbac but still getting same error.

ubuntu@controlpanel:~$ cat role.yml 
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  namespace: jenkins
  name: jenkins
rules:
- apiGroups: ["", "extensions", "apps"]
  resources: ["deployments", "replicasets", "pods"]
  verbs: ["get", "list", "watch", "create", "update", "delete", "patch"]


ubuntu@controlpanel:~$ cat sa.yml 
apiVersion: v1
kind: ServiceAccount
metadata:
  name: myaccount
  namespace: jenkins
ubuntu@controlpanel:~$ cat rolbin.yml 
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: jenkins
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: jenkins
subjects:
- kind: ServiceAccount
  name: myaccount

0 Answers
Related