ubogdan / operator

Example of Kubernetes operator that helps secure deployment of a web application.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Operator

Release

Running the Operator

Requirements

  • kubectl (>= 1.20)
  • Kubernetes distribution such as kind.

Setup

  • Setup Kind with ingress controller enabled
cat <<EOF | kind create cluster --config=-
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
  kubeadmConfigPatches:
  - |
    kind: InitConfiguration
    nodeRegistration:
      kubeletExtraArgs:
        node-labels: "ingress-ready=true"
  extraPortMappings:
  - containerPort: 80
    hostPort: 80
    protocol: TCP
  - containerPort: 443
    hostPort: 443
    protocol: TCP
EOF
  • Setup Nginx ingress controller
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/kind/deploy.yaml
  • Setup Cert-Manager
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.8.0/cert-manager.yaml
  • Edit email address in samples/cert-manager.yaml and apply configuration using the following command:
kubectl apply -f samples/cert-manager.yaml
  • Deploy the operator
kubectl apply -f https://raw.githubusercontent.com/ubogdan/operator/main/deploy/static/provider/kind/deploy.yaml

Setting up Your Development Environment

Requirements

Before you start, install the following tools and packages:

Get sources

git clone https://github.com/ubogdan/operator.git
cd operator

Setup

  • Setup Kind with ingress controller enabled
cat <<EOF | kind create cluster --config=-
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
  kubeadmConfigPatches:
  - |
    kind: InitConfiguration
    nodeRegistration:
      kubeletExtraArgs:
        node-labels: "ingress-ready=true"
  extraPortMappings:
  - containerPort: 80
    hostPort: 80
    protocol: TCP
  - containerPort: 443
    hostPort: 443
    protocol: TCP
EOF
  • Setup Nginx ingress controller
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/kind/deploy.yaml
  • Setup Cert-Manager
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.8.0/cert-manager.yaml
  • Edit email address in samples/cert-manager.yaml and apply configuration using the following command:
kubectl apply -f samples/cert-manager.yaml
  • Run the operator (development mode)
make install run
  • Edit samples/workloads_v1_container.yaml and apply configuration using the following command:
kubectl apply -f samples/workloads_v1_container.yaml

Recommended reading

About

Example of Kubernetes operator that helps secure deployment of a web application.

License:MIT License


Languages

Language:Go 75.5%Language:Makefile 21.2%Language:Dockerfile 3.3%