I want to create a webhook on pods creation. Kubernetes is running with minikube that is why for ca_bundle I am using the path to the ca.pem in the minikube/certs folder. However, I get such an error when I apply webhook configuration:
error: unable to recognize "pods-webhook.yaml": Get https://minikube-ip:8443/api?timeout=32s: dial tcp minikube-ip:8443: connect: connection refused
Is there anything else I should configure and should I set up another file for the ca_bundle?
I want to use this admission hook from the java-client. Here is the pods-webhook.yaml file:
apiVersion: admissionregistration.k8s.io/v1beta1
kind: ValidatingWebhookConfiguration
metadata:
name: pods-webhook
webhooks:
- name: create-pods-webhook
rules:
- apiGroups:
- ""
apiVersions:
- v1
operations:
- CREATE
resources:
- pods
clientConfig:
service:
name: create-pods-webhook-svc
namespace: default
path: "/validate"
caBundle: ${CA_BUNDLE}