单机部署Kube-batch

1、环境信息

      利用虚拟机,通过Minikube搭建kubernetes环境,安装和使用kube-batch,虚拟机基础环境参数如下:

操作系统

Centos 7 (Linux 3.10.0-1160.el7.x86_64)

CPU

8 核

内存

4 GB

磁盘

50 GB

2、kubernetes安装

1)关闭防火墙、selinux

# systemctl stop firewalld

# vi /etc/sysconfig/selinux ,修改SELINUX值为disabled

2)安装Docker

# yum install -y docker && systemctl enable docker && systemctl start docker

# docker version //查看状态

3)安装kubectl

# curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64  && chmod +x minikube

失败原因:网络无法连接storage.googleapis.com

解决办法:采用国内镜像网站

# cat <<EOF > /etc/yum.repos.d/kubernetes.repo

[kubernetes]

name=Kubernetes

baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/

enabled=1

gpgcheck=1

repo_gpgcheck=1

gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg https://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg

EOF

# yum install -y kubelet kubeadm kubectl

# systemctl enable kubelet && systemctl start kubelet

# kubectl version  //查看状态

4)安装Minikube

# curl -Lo minikube https://kubernetes.oss-cn-hangzhou.aliyuncs.com/minikube/releases/v1.13.0/minikube-linux-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/

# minikube version  //查看状态

# minikube start --vm-driver=none  //启动minikube

# minikube status  //查看状态

  

5)安装git、helm

# yum –y install git

#curl -L -o helm-v2.16.3-linux-amd64.tar.gz https://file.choerodon.com.cn/kubernetes-helm/v2.16.3/helm-v2.16.3-linux-amd64.tar.gz

# tar -zxvf helm-v2.16.3-linux-amd64.tar.gz  //解压缩

# mv linux-amd64/helm /usr/bin/helm  //文件移动到PATH目录

# helm completion bash > .hermrc ;echo "source .helmrc" >> .bashrc

# helm init --skip-refresh  //安装服务端tiller

# helm version //查看状态

3、安装部署kube-batch

1)helm方式安装

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

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

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

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

# helm list  //验证版本

2) yaml方式安装

1、创建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

2、创建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: kube-batch:v0.5 // docker pull kubesigs/kube-batch:v0.5

        args: ["--logtostderr", "--v", "3"]

        imagePullPolicy: IfNotPresent

        resources:

          limits:

            cpu: 2000m

            memory: 2048Mi

          requests:

            cpu: 2000m

            memory: 2048Mi

3、创建Queue

apiVersion: scheduling.incubator.k8s.io/v1alpha1

kind: Queue

metadata:

  name: default

spec:

  weight: 1

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值