<p>I have defined a <code>validatingWebhook</code> configuration with a custom controller that is deployed as a deployment, snippet below for <code>validatingWebhook</code>:</p>
<pre><code>apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingWebhookConfiguration
metadata:
  name: validate-webhook
  namespace: admission-test
webhooks:
  - name: admission.validate.com
   namespaceSelector:
  matchExpressions:
    - key: app
      operator: NotIn
      values: [&quot;admission-test&quot;]
rules:
  - apiGroups:   [&quot;*&quot;]
    apiVersions: [&quot;v1&quot;,&quot;v1beta1&quot;,&quot;v1alpha1&quot;]
    operations:  [&quot;CREATE&quot;,&quot;UPDATE&quot;]
    resources:   [&quot;deployments&quot;,&quot;daemonsets&quot;,&quot;statefulsets&quot;,&quot;cronjobs&quot;, &quot;rollouts&quot;, &quot;jobs&quot;]
    scope:       &quot;Namespaced&quot;
clientConfig:
  service:
    namespace: admission-test
    name: admission-test
    #service port
    port: 8090
    path: /verify
admissionReviewVersions: [&quot;v1&quot;]
sideEffects: None
</code></pre>
<p>and on my application I have defined a <code>http Handler</code>, snippet is below:</p>
<pre><code>    http.HandleFunc(&quot;/verify&quot;, servePod)
http.HandleFunc(&quot;/healthz&quot;, func(w http.ResponseWriter, r *http.Request) {
    w.WriteHeader(200)
    klog.Infoln(&quot;hittinh healthz&quot;)
    w.Write([]byte(&quot;ok&quot;))
})
server := &amp;http.Server{
    Addr:      fmt.Sprintf(&quot;:%d&quot;, port),
    TLSConfig: admission.ConfigTLS(config),
}
</code></pre>
<p>I am trying to create another simple nginx deployment, which can be found <a href="https://k8s.io/examples/controllers/nginx-deployment.yaml" rel="nofollow noreferrer">here</a> but when I try to print the the body of <code>/verify</code> in customer controller that I wrote, I don't get anything. In fact it's like the other deployments are not passing through the admission controller.</p>
<p>Any pointers on why this is happening? Much appreciated</p>
<p>running kubernetes version</p>
<pre><code>kubectl version
Client Version: version.Info{Major:&quot;1&quot;, Minor:&quot;21&quot;, GitVersion:&quot;v1.21.4&quot;, GitCommit:&quot;3cce4a82b44f032d0cd1a1790e6d2f5a55d20aae&quot;, GitTreeState:&quot;clean&quot;, BuildDate:&quot;2021-08-11T18:16:05Z&quot;, GoVersion:&quot;go1.16.7&quot;, Compiler:&quot;gc&quot;, Platform:&quot;darwin/amd64&quot;}
Server Version: version.Info{Major:&quot;1&quot;, Minor:&quot;21&quot;, GitVersion:&quot;v1.21.4&quot;, GitCommit:&quot;3cce4a82b44f032d0cd1a1790e6d2f5a55d20aae&quot;, GitTreeState:&quot;clean&quot;, BuildDate:&quot;2021-08-11T18:10:22Z&quot;, GoVersion:&quot;go1.16.7&quot;, Compiler:&quot;gc&quot;, Platform:&quot;linux/amd64&quot;} 
</code></pre>
<p>k8s cluster is running via docker desktop</p>

sai
<p>It's passing through the validation controller due to it's set as <code>scope:       &quot;Namespaced&quot;</code> and I can't see any <code>namespace</code> specified in your nginx deployment file. You can add any working <code>namespace</code> or change your <code>scope</code> to <code>&quot;*&quot;</code></p>
<p>You can find more information about the rules in <a href="https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/#matching-requests-rules" rel="nofollow noreferrer">the official documentation</a></p>
