kube-batch(一)安装

安装

官方:https://github.com/kubernetes-sigs/kube-batch

下载镜像

安装

官方:https://github.com/kubernetes-sigs/kube-batch

下载镜像

image-20200709105911547

使用v0.5

docker pull kubesigs/kube-batch:v0.5

两种安装方式

  • 第一种:使用yaml安装
  • 第二种:使用helm安装

第一种:使用yaml 安装方式

【Step1】创建 CRD

kubectl create -f scheduling_v1alpha1_podgroup.yaml
kubectl create -f scheduling_v1alpha2_podgroup.yaml
kubectl create -f scheduling_v1alpha1_queue.yaml
kubectl create -f scheduling_v1alpha2_queue.yaml

scheduling_v1alpha1_podgroup.yaml

 apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  name: podgroups.scheduling.incubator.k8s.io
  annotations:
    "helm.sh/hook": "crd-install"
spec:
  group: scheduling.incubator.k8s.io
  names:
    kind: PodGroup
    plural: podgroups
  scope: Namespaced
  validation:
    openAPIV3Schema:
      properties:
        apiVersion:
          type: string
        kind:
          type: string
        metadata:
          type: object
        spec:
          properties:
            minMember:
              format: int32
              type: integer
            queue:
              type: string
            priorityClassName:
              type: string
          type: object
        status:
          properties:
            succeeded:
              format: int32
              type: integer
            failed:
              format: int32
              type: integer
            running:
              format: int32
              type: integer
          type: object
      type: object
  version: v1alpha1

scheduling_v1alpha2_podgroup.yaml

apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  name: podgroups.scheduling.sigs.dev
spec:
  group: scheduling.sigs.dev
  names:
    kind: PodGroup
    plural: podgroups
  scope: Namespaced
  validation:
    openAPIV3Schema:
      properties:
        apiVersion:
          type: string
        kind:
          type: string
        metadata:
          type: object
        spec:
          properties:
            minMember:
              format: int32
              type: integer
            queue:
              type: string
            priorityClassName:
              type: string
          type: object
        status:
          properties:
            succeeded:
              format: int32
              type: integer
            failed:
              format: int32
              type: integer
            running:
              format: int32
              type: integer
          type: object
      type: object
  version: v1alpha2

scheduling_v1alpha1_queue.yaml

apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  name: queues.scheduling.incubator.k8s.io
  annotations:
    "helm.sh/hook": "crd-install"
spec:
  group: scheduling.incubator.k8s.io
  names:
    kind: Queue
    plural: queues
  scope: Cluster
  validation:
    openAPIV3Schema:
      properties:
        apiVersion:
          type: string
        kind:
          type: string
        metadata:
          type: object
        spec:
          properties:
            weight:
              format: int32
              type: integer
          type: object
      type: object
  version: v1alpha1

scheduling_v1alpha2_queue.yaml

apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  name: queues.scheduling.sigs.dev
spec:
  group: scheduling.sigs.dev
  names:
    kind: Queue
    plural: queues
  scope: Cluster
  validation:
    openAPIV3Schema:
      properties:
        apiVersion:
          type: string
        kind:
          type: string
        metadata:
          type: object
        spec:
          properties:
            weight:
              format: int32
              type: integer
          type: object
        status:
          properties:
            unknown:
              format: int32
              type: integer
            pending:
              format: int32
              type: integer
            running:
              format: int32
              type: integer
          type: object
      type: object
  version: v1alpha2

【Step2】 创建deployment

kubectl create -f deployment.yaml

deployment.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  name: kube-batch
  labels:
    chart: kube-batch-kube-batch
spec:
  replicas: 1
  selector:
    matchLabels:
      app: kube-batch
  template:
    metadata:
      labels:
        app: kube-batch
    spec:
      containers:
      - name: kube-batch
        image: 10.220.54.6:8088/kuai/kube-batch:v0.5
        args: ["--logtostderr", "--v", "3"]
        imagePullPolicy: IfNotPresent
        resources:
          limits:
            cpu: 2000m
            memory: 2048Mi
          requests:
            cpu: 2000m
            memory: 2048Mi

【Step3】创建Queue

apiVersion: scheduling.incubator.k8s.io/v1alpha1
kind: Queue
metadata:
  name: default
spec:
  weight: 1

第二种:使用helm 安装方式

【Step1】 下载kube-batch

#mkdir -p $GOPATH/src/github.com/kubernetes-sigs/

#cd $GOPATH/src/github.com/kubernetes-sigs/

#git clone http://github.com/kubernetes-sigs/kube-batch

【Step2】通过helm部署kube-batch

#helm install $GOPATH/src/github.com/kubernetes-sigs/kube-batch/deployment/kube-batch --namespace kube-system

【Step3】查看是否安装成功后

#helm list

使用v0.5

docker pull kubesigs/kube-batch:v0.5

两种安装方式

  • 第一种:使用yaml安装
  • 第二种:使用helm安装

第一种:使用yaml 安装方式

【Step1】创建 CRD

kubectl create -f scheduling_v1alpha1_podgroup.yaml
kubectl create -f scheduling_v1alpha2_podgroup.yaml
kubectl create -f scheduling_v1alpha1_queue.yaml
kubectl create -f scheduling_v1alpha2_queue.yaml

scheduling_v1alpha1_podgroup.yaml

 apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  name: podgroups.scheduling.incubator.k8s.io
  annotations:
    "helm.sh/hook": "crd-install"
spec:
  group: scheduling.incubator.k8s.io
  names:
    kind: PodGroup
    plural: podgroups
  scope: Namespaced
  validation:
    openAPIV3Schema:
      properties:
        apiVersion:
          type: string
        kind:
          type: string
        metadata:
          type: object
        spec:
          properties:
            minMember:
              format: int32
              type: integer
            queue:
              type: string
            priorityClassName:
              type: string
          type: object
        status:
          properties:
            succeeded:
              format: int32
              type: integer
            failed:
              format: int32
              type: integer
            running:
              format: int32
              type: integer
          type: object
      type: object
  version: v1alpha1

scheduling_v1alpha2_podgroup.yaml

apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  name: podgroups.scheduling.sigs.dev
spec:
  group: scheduling.sigs.dev
  names:
    kind: PodGroup
    plural: podgroups
  scope: Namespaced
  validation:
    openAPIV3Schema:
      properties:
        apiVersion:
          type: string
        kind:
          type: string
        metadata:
          type: object
        spec:
          properties:
            minMember:
              format: int32
              type: integer
            queue:
              type: string
            priorityClassName:
              type: string
          type: object
        status:
          properties:
            succeeded:
              format: int32
              type: integer
            failed:
              format: int32
              type: integer
            running:
              format: int32
              type: integer
          type: object
      type: object
  version: v1alpha2

scheduling_v1alpha1_queue.yaml

apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  name: queues.scheduling.incubator.k8s.io
  annotations:
    "helm.sh/hook": "crd-install"
spec:
  group: scheduling.incubator.k8s.io
  names:
    kind: Queue
    plural: queues
  scope: Cluster
  validation:
    openAPIV3Schema:
      properties:
        apiVersion:
          type: string
        kind:
          type: string
        metadata:
          type: object
        spec:
          properties:
            weight:
              format: int32
              type: integer
          type: object
      type: object
  version: v1alpha1

scheduling_v1alpha2_queue.yaml

apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  name: queues.scheduling.sigs.dev
spec:
  group: scheduling.sigs.dev
  names:
    kind: Queue
    plural: queues
  scope: Cluster
  validation:
    openAPIV3Schema:
      properties:
        apiVersion:
          type: string
        kind:
          type: string
        metadata:
          type: object
        spec:
          properties:
            weight:
              format: int32
              type: integer
          type: object
        status:
          properties:
            unknown:
              format: int32
              type: integer
            pending:
              format: int32
              type: integer
            running:
              format: int32
              type: integer
          type: object
      type: object
  version: v1alpha2

【Step2】 创建deployment

kubectl create -f deployment.yaml

deployment.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  name: kube-batch
  labels:
    chart: kube-batch-kube-batch
spec:
  replicas: 1
  selector:
    matchLabels:
      app: kube-batch
  template:
    metadata:
      labels:
        app: kube-batch
    spec:
      containers:
      - name: kube-batch
        image: 10.220.54.6:8088/kuai/kube-batch:v0.5
        args: ["--logtostderr", "--v", "3"]
        imagePullPolicy: IfNotPresent
        resources:
          limits:
            cpu: 2000m
            memory: 2048Mi
          requests:
            cpu: 2000m
            memory: 2048Mi

【Step3】创建Queue

apiVersion: scheduling.incubator.k8s.io/v1alpha1
kind: Queue
metadata:
  name: default
spec:
  weight: 1

第二种:使用helm 安装方式

【Step1】 下载kube-batch

#mkdir -p $GOPATH/src/github.com/kubernetes-sigs/

#cd $GOPATH/src/github.com/kubernetes-sigs/

#git clone http://github.com/kubernetes-sigs/kube-batch

【Step2】通过helm部署kube-batch

#helm install $GOPATH/src/github.com/kubernetes-sigs/kube-batch/deployment/kube-batch --namespace kube-system

【Step3】查看是否安装成功后

#helm list
posted @ 2020-07-10 17:17  sixinshuier  阅读(562)  评论(0编辑  收藏  举报