From 81db354ed7c957c600f5fd1c4bf232e621db3dcc Mon Sep 17 00:00:00 2001 From: Greg Weber Date: Tue, 12 Mar 2019 10:45:45 -0700 Subject: [PATCH 1/3] automatically set the scheduler K8s version This is tested to work on GKE --- charts/tidb-operator/templates/scheduler-deployment.yaml | 2 +- charts/tidb-operator/values.yaml | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/charts/tidb-operator/templates/scheduler-deployment.yaml b/charts/tidb-operator/templates/scheduler-deployment.yaml index 656b0c1fcd3..6d63bc1f372 100644 --- a/charts/tidb-operator/templates/scheduler-deployment.yaml +++ b/charts/tidb-operator/templates/scheduler-deployment.yaml @@ -35,7 +35,7 @@ spec: - -v={{ .Values.scheduler.logLevel }} - -port=10262 - name: kube-scheduler - image: {{ required "scheduler.kubeSchedulerImage is required! Its verison must be the same as your kubernetes cluster version" .Values.scheduler.kubeSchedulerImage }} + image: {{ required "scheduler.kubeSchedulerImageName is required" .Values.scheduler.kubeSchedulerImageName }}:{{ .Values.scheduler.kubeSchedulerImageTag | default (split "-" .Capabilities.KubeVersion.GitVersion)._0 }} resources: {{ toYaml .Values.scheduler.resources | indent 12 }} command: diff --git a/charts/tidb-operator/values.yaml b/charts/tidb-operator/values.yaml index e8ff2f2f5ea..2de213e0e93 100644 --- a/charts/tidb-operator/values.yaml +++ b/charts/tidb-operator/values.yaml @@ -50,5 +50,6 @@ scheduler: requests: cpu: 80m memory: 50Mi - # this hyperkube verison must be the same as your kubernetes cluster version - # kubeSchedulerImage: gcr.io/google-containers/hyperkube:v1.12.1 + kubeSchedulerImageName: gcr.io/google-containers/hyperkube + # This will default to matching your kubernetes version + # kubeSchedulerImageTag: From 0ac07e061d6fe045dcc424771f8f2a1865aae170 Mon Sep 17 00:00:00 2001 From: Greg Weber Date: Wed, 13 Mar 2019 14:24:11 -0700 Subject: [PATCH 2/3] update docs --- docs/google-kubernetes-tutorial.md | 3 +-- docs/operation-guide.md | 1 + docs/setup.md | 14 +++++++++++--- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/docs/google-kubernetes-tutorial.md b/docs/google-kubernetes-tutorial.md index 3b622e66fa5..62e73e3b8b3 100644 --- a/docs/google-kubernetes-tutorial.md +++ b/docs/google-kubernetes-tutorial.md @@ -93,10 +93,9 @@ When you see `Running`, it's time to hit `Control + C` and proceed to the next s The first TiDB component we are going to install is the TiDB Operator, using a Helm Chart. TiDB Operator is the management system that works with Kubernetes to bootstrap your TiDB cluster and keep it running. This step assumes you are in the `tidb-operator` working directory: - KUBE_VERSION=$(kubectl version --short | awk '/Server/{print $NF}' | awk -F '-' '{print $1}') && kubectl apply -f ./manifests/crd.yaml && kubectl apply -f ./manifests/gke-storage.yml && - helm install ./charts/tidb-operator -n tidb-admin --namespace=tidb-admin --set scheduler.kubeSchedulerImage=gcr.io/google-containers/hyperkube:${KUBE_VERSION} + helm install ./charts/tidb-operator -n tidb-admin --namespace=tidb-admin We can watch the operator come up with: diff --git a/docs/operation-guide.md b/docs/operation-guide.md index 39821ac4f76..60a5c3fdb32 100644 --- a/docs/operation-guide.md +++ b/docs/operation-guide.md @@ -115,6 +115,7 @@ $ kubectl get pv -l app.kubernetes.io/namespace=${namespace},app.kubernetes.io/m > **Note:** the above command will delete the data permanently. Think twice before executing them. + ## Monitor TiDB cluster is monitored with Prometheus and Grafana. When TiDB cluster is created, a Prometheus and Grafana pod will be created and configured to scrape and visualize metrics. diff --git a/docs/setup.md b/docs/setup.md index 68a010d1862..1dc33b4c742 100644 --- a/docs/setup.md +++ b/docs/setup.md @@ -4,13 +4,16 @@ Before deploying the TiDB Operator, make sure the following requirements are satisfied: -* Kubernetes v1.10 or later +* Kubernetes v1.10 or greater * [DNS addons](https://kubernetes.io/docs/tasks/access-application-cluster/configure-dns-cluster/) * [PersistentVolume](https://kubernetes.io/docs/concepts/storage/persistent-volumes/) * [RBAC](https://kubernetes.io/docs/admin/authorization/rbac) enabled (optional) -* [Helm](https://helm.sh) v2.8.2 or later +* [Helm](https://helm.sh) v2.8.2 or greater +* Kubernetes v1.12 is required for zone-aware persistent volumes. -> **Note:** Though TiDB Operator can use network volume to persist TiDB data, it is highly recommended to set up [local volume](https://kubernetes.io/docs/concepts/storage/volumes/#local) for better performance. Because TiDB already replicates data, network volume will add extra replicas which is redundant. +> **Note:** Allthough TiDB Operator can use network volume to persist TiDB data, this is slower due to redundant replication. It is highly recommended to set up [local volume](https://kubernetes.io/docs/concepts/storage/volumes/#local) for better performance. + +> **Note:** Network volumes in a multi availability zone setup require Kubernetes v1.12 or greater. We do recommend using networked volumes for backup in the tidb-bakup chart. ## Kubernetes @@ -151,3 +154,8 @@ $ helm upgrade tidb-operator charts/tidb-operator When a new version of tidb-operator comes out, simply update the `operatorImage` in values.yaml and run the above command should be enough. But for safety reasons, you should get the new charts from tidb-operator repo and merge the old values.yaml with new values.yaml. And then upgrade as above. TiDB Operator is for TiDB cluster maintenance, what this means is that when TiDB cluster is up and running, you can just stop TiDB Operator and TiDB cluster still works well unless you need to do TiDB cluster maintenance like scaling, upgrading etc. + +## Upgrade Kubernetes + +When you have a major version change of Kubernetes, you need to make sure that the kubeSchedulerImageTag matches it. By default, this value is generated by helm during install/upgrade so you need to perform a helm upgrade to reset it. + From 6fdaed0a7c5c293f219a591d6d4736f559a5e608 Mon Sep 17 00:00:00 2001 From: Greg Weber Date: Thu, 14 Mar 2019 15:34:26 -0700 Subject: [PATCH 3/3] update the e2e test values --- images/tidb-operator-e2e/tidb-operator-values.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/images/tidb-operator-e2e/tidb-operator-values.yaml b/images/tidb-operator-e2e/tidb-operator-values.yaml index ff274d928e0..e6789ad4ee7 100644 --- a/images/tidb-operator-e2e/tidb-operator-values.yaml +++ b/images/tidb-operator-e2e/tidb-operator-values.yaml @@ -50,4 +50,5 @@ scheduler: requests: cpu: 80m memory: 50Mi - kubeSchedulerImage: mirantis/hypokube:final + kubeSchedulerImageName: mirantis/hypokube + kubeSchedulerImageTag: final