Coder Social home page Coder Social logo

denyenv-validating-admission-webhook's Introduction

Hi there ๐Ÿ‘‹

I currently make โ˜ Cloud Native for a live.

denyenv-validating-admission-webhook's People

Contributors

phosae avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

denyenv-validating-admission-webhook's Issues

Deploy the webhook outside the cluster, Error: failed to call webhook:Post "https://192.168.230.129:8000/validate?timeout=3s": http: server gave HTTP response to HTTPS client

Hi, I followed your guide and deployed the webhook outside the cluster, but the error happens when the webhook is called
I used ubuntu 20.04, and the cluster is created by kind, Kubernetes version:1.23.4, and I did not change anything except the IP address
Could you please help me out TAT
Thank you sooooo much!

Error from server (InternalError): Internal error occurred: failed calling webhook "denyenv.zeng.dev": failed to call webhook: Post "https://192.168.230.129:8000/validate?timeout=3s": http: server gave HTTP response to HTTPS client

I use cert-manager for TLS certificate management
(Actually, I tried to use Kubernetes CertificateSigningRequest as well, but the same error happens QAQ)

kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.8.0/cert-manager.yaml

and I verified the installation

root@ren-virtual-machine:/home/ren/goworkplace/src/webhook# kubectl get pods --namespace cert-manager
NAME                                       READY   STATUS    RESTARTS   AGE
cert-manager-64d9bc8b74-fmqll              1/1     Running   0          73s
cert-manager-cainjector-6db6b64d5f-z6k52   1/1     Running   0          73s
cert-manager-webhook-6c9dd55dc8-vz4n5      1/1     Running   0          73s

after that, I followed your guide to create the selfsigned-issuer, the secret and the webhook configuration

root@ren-virtual-machine:/home/ren/goworkplace/src/webhook# kubectl apply -f k-cert-manager.yaml 
issuer.cert-manager.io/denyenv-selfsigned-issuer created
certificate.cert-manager.io/denyenv-tls-secret created
root@ren-virtual-machine:/home/ren/goworkplace/src/webhook# kubectl get ValidatingWebhookConfiguration denyenv -o yaml
apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingWebhookConfiguration
metadata:
  annotations:
    cert-manager.io/inject-ca-from: default/denyenv-tls-secret
    kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"admissionregistration.k8s.io/v1","kind":"ValidatingWebhookConfiguration","metadata":{"annotations":{"cert-manager.io/inject-ca-from":"default/denyenv-tls-secret"},"name":"denyenv"},"webhooks":[{"admissionReviewVersions":["v1"],"clientConfig":{"caBundle":"","url":"https://192.168.230.129:8000/validate"},"failurePolicy":"Fail","matchPolicy":"Exact","name":"denyenv.zeng.dev","objectSelector":{"matchExpressions":[{"key":"app","operator":"NotIn","values":["denyenv"]}]},"rules":[{"apiGroups":[""],"apiVersions":["v1"],"operations":["CREATE"],"resources":["pods"],"scope":"*"}],"sideEffects":"None","timeoutSeconds":3}]}
  creationTimestamp: "2022-05-13T10:14:03Z"
  generation: 2
  name: denyenv
  resourceVersion: "1486"
  uid: 930c086a-c4b7-402b-80c2-a602ff69574b
webhooks:
- admissionReviewVersions:
  - v1
  clientConfig:
    caBundle: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURXVENDQWtHZ0F3SUJBZ0lRZlViK0Rwc1R5bWd3YWhPVDEvKzdhekFOQmdrcWhraUc5dzBCQVFzRkFEQXQKTVJFd0R3WURWUVFLRXdoNlpXNW5MbVJsZGpFWU1CWUdBMVVFQXhNUFpHVnVlV1Z1ZGk1a1pXWmhkV3gwTUI0WApEVEl5TURVeE16RXdNVE15TjFvWERUSXpNRFV4TXpFd01UTXlOMW93TFRFUk1BOEdBMVVFQ2hNSWVtVnVaeTVrClpYWXhHREFXQmdOVkJBTVREMlJsYm5sbGJuWXVaR1ZtWVhWc2REQ0NBU0l3RFFZSktvWklodmNOQVFFQkJRQUQKZ2dFUEFEQ0NBUW9DZ2dFQkFLTWkvRmlSQVlmWTA3ZFRxUUVlbEVRc1ErOEVWRjZuMVpoL1N5RkR5RytHcnVmZQp3OStvb0xkbEg3V3BnSWRZZ3JvYjVKVkVSbHRCQ1ZNeHRDc2VFandLOCtlSWNJOEx6bXY0UFJpRDFzVnQyeHp0ClBYTUk1YkMzNlZaaGtXRlp2eUJRWGZBYnVQWExyaz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
    url: https://192.168.230.129:8000/validate
  failurePolicy: Fail
  matchPolicy: Exact
  name: denyenv.zeng.dev
  namespaceSelector: {}
  objectSelector:
    matchExpressions:
    - key: app
      operator: NotIn
      values:
      - denyenv
  rules:
  - apiGroups:
    - ""
    apiVersions:
    - v1
    operations:
    - CREATE
    resources:
    - pods
    scope: '*'
  sideEffects: None
  timeoutSeconds: 3

after that, I get the cert and key, then run the webhook on vscode, then test

root@ren-virtual-machine:/home/ren/goworkplace/src/webhook# kubectl get secret denyenv-tls-secret -o jsonpath={.data.'tls\.crt'} | base64 -d > tls.crt
root@ren-virtual-machine:/home/ren/goworkplace/src/webhook# kubectl get secret denyenv-tls-secret -o jsonpath={.data.'tls\.key'} | base64 -d > tls.
root@ren-virtual-machine:/home/ren/goworkplace/src/webhook# kubectl run nginx --image nginx --env='FOO=BAR'
Error from server (InternalError): Internal error occurred: failed calling webhook "denyenv.zeng.dev": failed to call webhook: Post "https://192.168.230.129:8000/validate?timeout=3s": http: server gave HTTP response to HTTPS client

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.