What does Tugger do?

Prerequisites

kubectl api-versions | grep admissionregistration.k8s.io/v1beta1
admissionregistration.k8s.io/v1beta1

Build and Push Tugger Docker Image

# Build docker image
docker build -t jainishshah17/tugger:latest .
# Push it to Docker Registry
docker push jainishshah17/tugger:latest

Create Kubernetes Docker registry secret

# Create a Docker registry secret called 'regsecret'
kubectl create secret docker-registry regsecret --docker-server=${DOCKER_REGISTRY} --docker-username=${DOCKER_USER} --docker-password=${DOCKER_PASS} --docker-email=${DOCKER_EMAIL}

Generate TLS Certs for Tugger

./tls/gen-cert.sh

Get CA Bundle

./webhook/webhook-patch-ca-bundle.sh

Deploy Tugger to Kubernetes

# Run deployment
kubectl create -f deployment/tugger-deployment.yaml
# Create service
kubectl create -f deployment/tugger-svc.yaml
helm install --name tugger --set docker.registrySecret=regsecret,docker.registryUrl=jainishshah17,whitelistNamespaces="kube-system,default" chart/tugger/

Configure MutatingAdmissionWebhook and ValidatingAdmissionWebhook

# Configure MutatingAdmissionWebhook
kubectl create -f webhook/tugger-mutating-webhook-configuration.yaml
# Configure ValidatingWebhookConfiguration
kubectl create -f webhook/tugger-validating-webhook-configuration.yaml

Test Tugger

# Deploy nginx 
kubectl apply -f test/nginx.yaml
# Tugger Output
2019/01/27 20:57:24 AdmissionReview Namespace is: nginx
2019/01/27 20:57:24 Container Image is nginx
2019/01/27 20:57:24 Image is not being pulled from Private Registry: nginx
2019/01/27 20:57:24 Changing image registry to: jainishshah17/nginx

I’m a Software Developer. I am passionate about SAAS Solutions and Container Orchestration tools like DC/OS, Kubernetes, RedHat OpenShift, Docker Swarm.

I’m a Software Developer. I am passionate about SAAS Solutions and Container Orchestration tools like DC/OS, Kubernetes, RedHat OpenShift, Docker Swarm.