Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error MutatingWebhookConfiguration #2

Open
thiagosantosleite opened this issue Apr 9, 2021 · 1 comment
Open

error MutatingWebhookConfiguration #2

thiagosantosleite opened this issue Apr 9, 2021 · 1 comment

Comments

@thiagosantosleite
Copy link

thiagosantosleite commented Apr 9, 2021

I trying to add a annotation when a pod is created to allow cluster autoscaler delete an instance manager, but looks like I'm missing something.

webhook:

apiVersion: admissionregistration.k8s.io/v1beta1
kind: MutatingWebhookConfiguration
metadata:
  name: kube-annotate
  labels:
    app: kube-annotate
webhooks:
  - name: kube-annotate.example.com
    clientConfig:
      service:
        name: kube-annotate
        namespace: kube-annotate # NOTE: replace this with namespace where you deploy `kube-annotate`
        path: "/mutate"
      caBundle: <removed>
    rules:
      - operations: [ "CREATE" ]
        apiGroups: [""]
        apiVersions: ["v1"]
        resources: ["pods"]
    namespaceSelector:
      matchLabels:
        kube-annotate: 'enabled'

deployment:

`      - name: kube-annotate         
        image: docker.io/chickenzord/kube-annotate:latest
        imagePullPolicy: Always
        env:
        - name: TLS_ENABLED
          value: 'true'
        - name: TLS_CRT
          value: /var/run/secrets/tls/tlscert
        - name: TLS_KEY
          value: /var/run/secrets/tls/tlskey
        - name: RULES_FILE
          value: /etc/kube-annotate/rules.yaml
        - name: LOG_FORMAT
          value: json
        - name: LOG_LEVEL
          value: debug
`

config map:

`cat configmap.yaml 
apiVersion: v1
data:
  rules.yaml: |
    - selector:
        longhorn.io/component: instance-manager
      annotations:
        cluster-autoscaler.kubernetes.io/safe-to-evict: true
kind: ConfigMap
metadata:
  labels:
    app: kube-annotate
  name: kube-annotate-config
  namespace: kube-annotate
`

Error:

`kubectl logs -lapp=kube-annotate -n kube-annotate  -f
github.com/chickenzord/kube-annotate/vendor/github.com/urfave/negroni.middleware.ServeHTTP(0xe0bd80, 0xc00024ac60, 0xc0002554e0, 0x7fbed03e2020, 0xc00014e058, 0xc000332600)
        /go/src/github.com/chickenzord/kube-annotate/vendor/github.com/urfave/negroni/negroni.go:38 +0x9c
github.com/chickenzord/kube-annotate/vendor/github.com/urfave/negroni.(*Negroni).ServeHTTP(0xc00024da10, 0xe18ea0, 0xc00031c380, 0xc000332600)
        /go/src/github.com/chickenzord/kube-annotate/vendor/github.com/urfave/negroni/negroni.go:96 +0xee
net/http.serverHandler.ServeHTTP(0xc00026ab60, 0xe18ea0, 0xc00031c380, 0xc000332600)
        /usr/local/go/src/net/http/server.go:2741 +0xab
net/http.(*conn).serve(0xc00032c140, 0xe19ba0, 0xc000262680)
        /usr/local/go/src/net/http/server.go:1847 +0x646
created by net/http.(*Server).Serve
        /usr/local/go/src/net/http/server.go:2851 +0x2f5
{"level":"info","msg":"starting kube-annotate version 0.3.4 (7291937)","time":"2021-04-09T18:42:48Z"}
{"level":"info","msg":"loaded 1 rule(s) from /etc/kube-annotate/rules.yaml","time":"2021-04-09T18:42:48Z"}
{"level":"info","msg":"internal server is listening on :8081","time":"2021-04-09T18:42:48Z"}
{"level":"info","msg":"API server is listening on :8443","time":"2021-04-09T18:42:48Z"}
{"level":"debug","msg":"API server TLS is enabled","time":"2021-04-09T18:42:48Z"}
{"level":"info","msg":"starting kube-annotate version 0.3.4 (7291937)","time":"2021-04-09T18:42:48Z"}
{"level":"info","msg":"loaded 1 rule(s) from /etc/kube-annotate/rules.yaml","time":"2021-04-09T18:42:48Z"}
{"level":"info","msg":"internal server is listening on :8081","time":"2021-04-09T18:42:48Z"}
{"level":"info","msg":"API server is listening on :8443","time":"2021-04-09T18:42:48Z"}
{"level":"debug","msg":"API server TLS is enabled","time":"2021-04-09T18:42:48Z"}
`

Any ideas?

@thiagosantosleite
Copy link
Author

I'm using to fix it:
longhorn/longhorn#2203

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant