Skip to main content

13 posts tagged with "kubernetes"

View All Tags

Quick Start Guide for Volcano

· 2 min read

The easiest way to deploy Volcano is using Helm charts.

Preparation​

Clone the repository to a local path:

# mkdir -p $GOPATH/src/volcano.sh/
# cd $GOPATH/src/volcano.sh/
# git clone https://github.com/volcano-sh/volcano.git

1. Volcano Images​

Official images are available on DockerHub. You can also build local images by running the following command:

cd $GOPATH/src/volcano.sh/volcano
make images
## Verify your images.
# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
volcanosh/vk-admission latest a83338506638 8 seconds ago 41.4MB
volcanosh/vk-scheduler latest faa3c2a25ac3 9 seconds ago 49.6MB
volcanosh/vk-controllers latest 7b11606ebfb8 10 seconds ago 44.2MB

NOTE: Ensure that the images are correctly loaded to your Kubernetes cluster. For example, if you are using kind luster, run the kind load docker-image <image-name>:<tag> command for each image.

2. Helm Charts​

Install Helm charts.

helm install installer/chart --namespace <namespace> --name <specified-name>
For eg :
helm install installer/chart --namespace volcano-trial --name volcano-trial

Run the following commands to verify the installation:

#1. Verify whether pods are running normally.

# kubectl get pods --namespace <namespace>
NAME READY STATUS RESTARTS AGE
<specified-name>-admission-84fd9b9dd8-9trxn 1/1 Running 0 43s
<specified-name>-controllers-75dcc8ff89-42v6r 1/1 Running 0 43s
<specified-name>-scheduler-b94cdb867-89pm2 1/1 Running 0 43s
<specified-name>--admission-init-qbtmb 0/1 Completed 0 43s

#2. Verify the Services.
# kubectl get services --namespace <namespace>
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
<specified-name>-admission-service ClusterIP 10.105.78.53 <none> 443/TCP 91s

Watch the following video to learn how to deploy Volcano:​

Bringing Up Kube-Batch

· 4 min read

This document describes how to run kube-batch as a batch scheduler for Kubernetes. To get the complete code, go to master.

1. Prerequisites​

Before running kube-batch, you must start up a Kubernetes cluster (see Creating a Cluster with Kubeadm). To complete local testing and deployment, you can use Minikube (see Running Kubernetes Locally with Minikube. You can also use kind to run local Kubernetes clusters with Docker container "nodes".

kube-batch needs to be run as a Kubernetes scheduler. The following sections describe how to run kube-batch as a Kubernetes scheduler quickly. For details, see Configure Multiple Schedulers.

2. Configuring kube-batch for Kubernetes​

(1) kube-batch image​

You can download the official kube-batch image from DockerHub. The latest version is v0.4.

# docker pull kubesigs/kube-batch:v0.4

(2) Creating a Kubernetes Deployment for kube-batch​

Downloading kube-batch​

# mkdir -p $GOPATH/src/github.com/kubernetes-sigs/
# cd $GOPATH/src/github.com/kubernetes-sigs/
# git clone https://github.com/kubernetes-sigs/kube-batch

Deploying kube-batch with Helm​

Run kube-batch as a Kubernetes scheduler.

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

Check the version of kube-batch.

# helm list
NAME REVISION UPDATED STATUS CHART NAMESPACE
dozing-otter 1 Thu Jun 14 18:52:15 2018 DEPLOYED kube-batch-0.4.0 kube-system

NOTE: kube-batch needs to collect cluster information (such as pods, nodes, and CRDs) for scheduling, so the service account used by the Deployment must have permission to access those cluster resources. Otherwise, kube-batch cannot start up. If you are not familiar with Kubernetes RBAC, please copy example/role.yaml to $GOPATH/src/github.com/kubernetes-sigs/kube-batch/deployment/kube-batch/templates/ and reinstall kube-batch.

(3) Creating a Job​

Create a file named job-01.yaml with the following content:

apiVersion: batch/v1
kind: Job
metadata:
name: qj-1
spec:
backoffLimit: 6
completions: 6
parallelism: 6
template:
metadata:
annotations:
scheduling.k8s.io/group-name: qj-1
spec:
containers:
- image: busybox
imagePullPolicy: IfNotPresent
name: busybox
resources:
requests:
cpu: "1"
restartPolicy: Never
schedulerName: kube-batch
---
apiVersion: scheduling.incubator.k8s.io/v1alpha1
kind: PodGroup
metadata:
name: qj-1
spec:
minMember: 6

The YAML file represents a job named qj-01, which is used to create 6 pods (specified by parallelism). These pods will be scheduled by the scheduler kube-batch (specified by schedulerName). kube-batch watches the PodGroup and the annotation scheduling.k8s.io/group-name. The annotation identifies to which group a pod belongs to. kube-batch will start .spec.minMember pods for a job at the same time. If resources are insufficient, kube-batch will not start any pods for the job.

Create a job.

# kubectl create -f job-01.yaml

Check the job status.

# kubectl get jobs
NAME DESIRED SUCCESSFUL AGE
qj-1 6 6 2h

Check the pod statuses.

# kubectl get pod --all-namespaces

4. Creating a PriorityClass for Pods​

The kube-batch scheduler starts pods by their priority in the same QueueJob. Pods with a higher priority are started first. The following example demonstrates how to use PriorityClass:

Create a file named priority_1000.yaml with the following content:

apiVersion: scheduling.k8s.io/v1beta1
kind: PriorityClass
metadata:
name: high-priority
namespace: batch-ns01
value: 1000

Create a PriorityClass with priority 1000.

# kubectl create -f priority_1000.yaml

Create a pod configuration file named pod-config-ns01-r01.yaml.

apiVersion: v1
kind: Pod
metadata:
name: pod-ns01-r01
spec:
containers:
- name: key-value-store
image: redis
resources:
limits:
memory: "1Gi"
cpu: "1"
requests:
memory: "1Gi"
cpu: "1"
ports:
- containerPort: 6379
priorityClassName: high-priority

Create a pod with priority 1000.

# kubectl create -f pod-config-ns01-r01.yaml

NOTE:

  • PriorityClass is supported only by Kubernetes 1.9 or later.
  • Pods in the same Deployment, RS, or job share the same pod template, so they have the same PriorityClass. To specify a different PriorityClass for each pod in the same QueueJob, please create a new controller.