<p>Using <a href="https://kubernetes.io/docs/reference/access-authn-authz/rbac/" rel="nofollow noreferrer">Kubernetes RBAC</a>, we can restrict access to specific resources via specific verbs.</p>
<p>Is there a way to disallow the creation of Services with <code>type=LoadBalancer</code> while allowing other types of Services (e.g. <code>type=NodePort</code>)?</p>
<p>Sample <a href="https://kubernetes.io/docs/concepts/services-networking/service/" rel="nofollow noreferrer">Service</a> which we want to disallow:</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: my-service
spec:
  selector:
    app: MyApp
  ports:
    - protocol: TCP
      port: 80
      targetPort: 9376
  clusterIP: 10.0.171.239
  type: LoadBalancer
status:
  loadBalancer:
    ingress:
    - ip: 192.0.2.127
</code></pre>
<p>Following is the closest RBAC role we can define - to disallow update operations for all Services (disallowing more than we want):</p>
<pre><code>apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  namespace: default
  name: developer
rules:
- apiGroups: [&quot;&quot;] # &quot;&quot; indicates the core API group
  resources: [&quot;services&quot;]
  verbs: [&quot;get&quot;, &quot;watch&quot;, &quot;list&quot;]
</code></pre>

user3407789
<p>Its not possible to limit what you asking for.<br />
As you mentioned and you figured it out you can limit access to the API (resources &amp;&amp; verbs) but you cant restrict the content of the resource in a simple way.</p>
<p>You will be able to do such a thing if you will write your own hooks in `Admission Control hooks'</p>
<p><code>Admission Control hooks</code> can capture your request and then you check out the content + the user who initiated the request.</p>
<p>It's not a straightforward and nor a simple one, but you will be able to achieve what you asked for.</p>
<p><a href="https://i.stack.imgur.com/TrjtT.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TrjtT.jpg" alt="enter image description here" /></a></p>
<hr />
<p><a href="https://i.stack.imgur.com/kiK4T.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kiK4T.jpg" alt="enter image description here" /></a></p>
