I want to create a service account which should have 0 access of k8s api. Is it possible to create such account ? What will be role definition?
You could try to define a Role like this:
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: nothing
rules: []
Create it:
kubectl apply -f nothing.yaml
Then bind it to your ServiceAccount:
kubectl create rolebinding nothing --serviceaccount my-serviceaccount --role nothing
Kubernetes follows the principle of least priviledge.If you create a service account but don't attach any role binding or cluster role binding to it then it will not have any access to Kubernetes API.