i

👁‍🗨 i is an Kubernetes Operator for restarting old pod by custom policies 👁‍🗨

APACHE-2.0 License

Stars
4

i

i is an Kubernetes Operator for restarting old pod policies management.

NOTE: This is not for production usage. It is under PoC.

Design

Every pod will be supervised by the eye...

Here, I will explain the breif design.

Architecture

The controller runs syncer by the resource from input and watches the pod.

Controller --> Syncer -(watch)-> Pod

And then delete the pod and recreates. At the time, the controller will notify via slack which will be configured by Secret resource.

Install CRD

First, you will need to install this CRD. Run this command.

$ kustomize build "https://raw.githubusercontent.com/KeisukeYamashita/i/master/config/crd" | kubectl apply -f 

Then, check crd status.

$ kubectl get crd

Create secret for slack notification: Optional

Create a secret.

apiVersion:
Kind: Secret
metadata:
    app: YOUR_SECRET_NAME
data:
    SLACK_URL: "https://hook.xxx.xxx"

And then apply.

$ kubectl apply -f slack-channel-1.yml

Eye resource

Create a custom resource. You can create many rules. Note that spec.secrectRef is optional.

apiVersion: i.keisukeyamashita.com/alphav1
Kind: Eye
metadata:
    app: my-eye
    msg: "I see you"
spec:
    lifetime: "100m"
    secretRef:
        name: YOUR_SECRET_NAME

Then apply your resource.

$ kubectl aaply -f my-eye.yml

Check you status.

$ kubectl get eye

If you set it all correctly, you will see a post in slack at the event.

Note that this is optional.

Multi eyes support

You can create multiple eyes(policies) for multi lifetime and different slack post.

apiVersion: i.keisukeyamashita.com/alphav1
Kind: Eye
metadata:
    app: my-left-eye
spec:
    lifetime: "100m"
    secretRef:
        name: YOUR_SECRET_NAME_LEFT
---
apiVersion: i.keisukeyamashita.com/alphav1
Kind: Eye
metadata:
    app: my-right-eye
spec:
    lifetime: "3h"
    secretRef:
        name: YOUR_SECRET_NAME_RIGHT

Happy eyes:)

License

Copyright 2019 The i Authors. i is released under the Apache License 2.0.

Author