A Kubernetes resource mutator
You should set up your self
Modify examples/tls/ca.conf, examples/tls/csr-prod.conf.
Generate certifate,
cd examples/tls
DEPLOYMENT=us-east-1 CLUSTER=PRODUCTION ./new-kubemutator-cert.rb
cat examples/tls/us-east-1/PRODUCTION/ca.crt | base64
First replace examples/kubernetes/mutating-webhook-configuration.yaml webhooks[0].clientConfig.caBundle with your ca.crt base64 generated before
Apply the mutating webhook configuration
kubectl -n kube-system apply -f examples/kubernetes/mutating-webhook-configuration.yaml
kubectl -n kube-system apply -f serviceaccount.yaml
kubectl -n kube-system apply -f clusterrole.yaml
kubectl -n kube-system apply -f clusterrolebinding.yaml
kubectl -n kube-system apply -f configmap.yaml # !! rewrite configmap with your config file and mutator cert and key
kubectl -n kube-system apply -f deployment.yaml
kubectl -n kube-system apply -f service.yaml
# if you have prometheus operator deployed, you can add service monitor below
kubectl -n kube-system apply -f service-monitor.yaml
cd examples/chart
# generate you custom values
helm inspect values kubemutator > custom.yaml
# make some changes to custom.yaml
# show what would happen next
helm template --name kubemutator --namespace kube-system -f custom.yaml kubemutator
# install to your Kubernetes cluster
helm install --name kubemutator --namespace kube-system -f custom.yaml kubemutator
An example configuration is in examples/conf/config.yml
annotationKey: kubemutator.example.com/requests
strategies:
- name: filebeat
patches:
# add filebeat sidecar
- isTemplate: true
data: |
op: add
path: /spec/containers/-
value:
name: filebeat
image: myrepo/filebeat
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 100m
memory: 128Mi
volumeMounts:
- name: logs
mountPath: /var/log/{{ .Labels.k8s-app }}
rules:
- namespace:
- default
selector:
matchLabels:
k8s-app: myapp
strategies:
- filebeat
patch data see: https://tools.ietf.org/html/rfc6902
rules, match namespace and selector.annotationKey, append the strategies joined by comma to the strategy list.MIT
Content type
Image
Digest
sha256:aca74bc2e…
Size
16.6 MB
Last updated
about 4 years ago
docker pull major1201/kubemutator