Giter Site home page Giter Site logo

Kubernetes driver about peanut HOT 1 OPEN

andrepiske avatar andrepiske commented on July 22, 2024
Kubernetes driver

from peanut.

Comments (1)

Clivern avatar Clivern commented on July 22, 2024 1

Yeah, it is not tightly coupled with docker. there is an interface that has the needed functionality for k8s implementation (https://github.com/Clivern/Peanut/blob/main/core/runtime/base.go#L8-L11). tbh i am not sure when i will support k8s since i care about the command line first and there will a lot to do to support k8s.

Anyways here is how i see it:

  • Peanut can run outside the k8s cluster & uses the kube config to create/modify deployments, services and configmaps.
  • and it can be deployed inside the cluster and have service account to be able to create/modify deployments, services and configmaps from inside the cluster.

like here https://github.com/Clivern/Beetle/blob/main/core/kubernetes/cluster.go#L79-L106

for example here is how peanut will deploy etcd of course with API calls

# Deploy nginx ingress or you have it already
$ kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v0.41.2/deploy/static/provider/cloud/deploy.yaml
$ kubectl get pods -n ingress-nginx \
  -l app.kubernetes.io/name=ingress-nginx --watch
$ kubectl get svc --namespace=ingress-nginx

#-------------------------

# Deploy Etcd
echo "---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: etcd-deployment
spec:
  replicas: 1
  selector:
    matchLabels:
      app: etcd
  template:
    metadata:
      labels:
        app: etcd
      name: etcd
    spec:
      containers:
        -
          image: 'bitnami/etcd:3.5.0'
          name: etcd-app
          ports:
          - containerPort: 2379
          env:
          - 
            name: ALLOW_NONE_AUTHENTICATION
            value: 'yes'
---
apiVersion: v1
kind: Service
metadata:
  name: etcd-svc
  labels:
    app: etcd
spec:
  ports:
    -
      port: 2379
      targetPort: 2379
  selector:
    app: etcd
  type: LoadBalancer" > etcd_test.yml

$ kubectl apply -f etcd_test.yml
deployment.apps/etcd-deployment created
service/etcd-svc created

# Peanut will return the load balancer IP and a port to use.
$ kubectl get svc
NAME         TYPE           CLUSTER-IP       EXTERNAL-IP      PORT(S)          AGE
etcd-svc     LoadBalancer     X.X.X.X          Y.Y.Y.Y          2379:32002/TCP      25m

$ etcdctl --endpoints Y.Y.Y.Y:2379 member list

Some services need a config file. we can mount the config files in pod using a configmap.

from peanut.

Related Issues (8)

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.