Coder Social home page Coder Social logo

operator-demo's Introduction

What is it

This is an operator-demo. You can use it to create CRD, and listen the events that contains ADD/UPDATE/DELETE event.

Event ADD: Create apps of nginx, k8s cluster can access it through cluster ip

Event UPDATE: Update the version of nginx

Event DELETE: Delete all of pods, deployments, and services

How to get it

    
    cd $GOPATH/src/github.com/liqingsanjin
    
    git clone https://github.com/liqingsanjin/operator-demo.git

How to use it

  1. Enter the root dir of the project, $operator-demo is the project dir

    
    cd $GOPATH/src/github.com/liqingsanjin/operator-demo
    
    
    
  2. Build app, docker image and push the image

    
    sh dockerfiles/qiniu-nginx/build.sh yourImage
    
    
  3. Update the the image in the file (yaml/demo/qiniu_nginx.yaml). Then deploy the app in k8s cluster

    
    kubectl create -f yaml/demo/qiniu_nginx.yaml
    
    
  4. Create/Update/Delete an instance of the crd

    
    kubectl create -f yaml/demo/test_qiniu_nginx.yaml
    
    kubectl replace -f yaml/demo/test_qiniu_nginx.yaml
    
    kubectl delete -f yaml/demo/test_qiniu_nginx.yaml
    
    

Run it on other namespace

  1. Create service account
    kubectl create -f yaml/demo/service_account.yaml -n yourNamespace
  1. Create cluster role
    kubectl create -f yaml/demo/cluster_role.yaml
  1. Create cluster role binding
    kubectl create -f yaml/demo/cluster_role_binding.yaml

Then you need update the files(yaml/demo/qiniu_nginx.yaml, yaml/demo/cluster_role_binding.yaml), add the serviceAccountName and your namespace in them.

    serviceAccountName: yourServiceAccountName

Create the app

    kubectl create -f yaml/demo/qiniu_nginx.yaml -n yourNamespace

Run it with helm

    helm install helm/operator-demo

operator-demo's People

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.