Lightweight Kubernetes
 
 
 
 
Go to file
Kubernetes Submit Queue 49626c975b Merge pull request #44798 from zetaab/master
Automatic merge from submit-queue

Statefulsets for cinder: allow multi-AZ deployments, spread pods across zones

**What this PR does / why we need it**: Currently if we do not specify availability zone in cinder storageclass, the cinder is provisioned to zone called nova. However, like mentioned in issue, we have situation that we want spread statefulset across 3 different zones. Currently this is not possible with statefulsets and cinder storageclass. In this new solution, if we leave it empty the algorithm will choose the zone for the cinder drive similar style like in aws and gce storageclass solutions. 

**Which issue this PR fixes** fixes #44735

**Special notes for your reviewer**:

example:

```
kind: StorageClass
apiVersion: storage.k8s.io/v1beta1
metadata:
  name: all
provisioner: kubernetes.io/cinder
---
apiVersion: v1
kind: Service
metadata:
  annotations:
    service.alpha.kubernetes.io/tolerate-unready-endpoints: "true"
  name: galera
  labels:
    app: mysql
spec:
  ports:
  - port: 3306
    name: mysql
  clusterIP: None
  selector:
    app: mysql
---
apiVersion: apps/v1beta1
kind: StatefulSet
metadata:
  name: mysql
spec:
  serviceName: "galera"
  replicas: 3
  template:
    metadata:
      labels:
        app: mysql
      annotations:
        pod.alpha.kubernetes.io/initialized: "true"
    spec:
      containers:
      - name: mysql
        image: adfinissygroup/k8s-mariadb-galera-centos:v002
        imagePullPolicy: Always
        ports:
        - containerPort: 3306
          name: mysql
        - containerPort: 4444
          name: sst
        - containerPort: 4567
          name: replication
        - containerPort: 4568
          name: ist
        volumeMounts:
        - name: storage
          mountPath: /data
        readinessProbe:
          exec:
            command:
            - /usr/share/container-scripts/mysql/readiness-probe.sh
          initialDelaySeconds: 15
          timeoutSeconds: 5
        env:
          - name: POD_NAMESPACE
            valueFrom:
              fieldRef:
                apiVersion: v1
                fieldPath: metadata.namespace
  volumeClaimTemplates:
  - metadata:
      name: storage
      annotations:
        volume.beta.kubernetes.io/storage-class: all
    spec:
      accessModes: [ "ReadWriteOnce" ]
      resources:
        requests:
          storage: 12Gi
```

If this example is deployed it will automatically create one replica per AZ. This helps us a lot making HA databases.

Current storageclass for cinder is not perfect in case of statefulsets. Lets assume that cinder storageclass is defined to be in zone called nova, but because labels are not added to pv - pods can be started in any zone. The problem is that at least in our openstack it is not possible to use cinder drive located in zone x from zone y. However, should we have possibility to choose between cross-zone cinder mounts or not? Imo it is not good way of doing things that they mount volume from another zone where the pod is located(means more network traffic between zones)? What you think? Current new solution does not allow that anymore (should we have possibility to allow it? it means removing the labels from pv).

There might be some things that needs to be fixed still in this release and I need help for that. Some parts of the code is not perfect.

Issues what i am thinking about (I need some help for these):
1) Can everybody see in openstack what AZ their servers are? Can there be like access policy that do not show that? If AZ is not found from server specs, I have no idea how the code behaves. 
2) In GetAllZones() function, is it really needed to make new serviceclient using openstack.NewComputeV2 or could I somehow use existing one
3) This fetches all servers from some openstack tenant(project). However, in some cases kubernetes is maybe deployed only to specific zone. If kube servers are located for instance in zone 1, and then there are another servers in same tenant in zone 2. There might be usecase that cinder drive is provisioned to zone-2 but it cannot start pod, because kubernetes does not have any nodes in zone-2. Could we have better way to fetch kubernetes nodes zones? Currently that information is not added to kubernetes node labels automatically in openstack (which should I think). I have added those labels manually to nodes. If that zone information is not added to nodes, the new solution does not start stateful pods at all, because it cannot target pods.


cc @rootfs @anguslees @jsafrane 

```release-note
Default behaviour in cinder storageclass is changed. If availability is not specified, the zone is chosen by algorithm. It makes possible to spread stateful pods across many zones.
```
2017-05-09 08:10:44 -07:00
.github PR template: Update links to kubernetes/community repo 2017-03-17 12:23:58 -04:00
Godeps Update go-restful dependency 2017-05-05 13:57:01 -07:00
api Merge pull request #44682 from smarterclayton/owners 2017-05-07 12:22:06 -07:00
build Only tag release containers if the name is different. 2017-05-04 18:43:23 -07:00
cluster Merge pull request #45483 from mwielgus/ca0.5.4 2017-05-08 06:21:45 -07:00
cmd Merge pull request #44258 from wlan0/master 2017-05-08 16:34:43 -07:00
docs Merge pull request #44714 from jamiehannaford/unix_user_type 2017-05-05 14:08:17 -07:00
examples Merge pull request #45409 from humblec/glusterfs-code-cleanup 2017-05-08 14:54:37 -07:00
federation refactor names for the apiserver handling chain 2017-05-08 07:55:31 -04:00
hack Merge pull request #45463 from nilebox/nilebox-tpr-watcher-example 2017-05-09 06:52:34 -07:00
hooks Fix spelling in package naming linter error message 2016-12-20 15:48:14 -05:00
logo Updated top level owners file to match new format 2017-01-19 11:29:16 -08:00
pkg Merge pull request #44798 from zetaab/master 2017-05-09 08:10:44 -07:00
plugin Merge pull request #45472 from k82cn/rm_unused_func 2017-05-08 15:46:41 -07:00
staging Merge pull request #45403 from sttts/sttts-tri-state-watch-capacity 2017-05-09 07:27:35 -07:00
test Merge pull request #45463 from nilebox/nilebox-tpr-watcher-example 2017-05-09 06:52:34 -07:00
third_party autogenerated 2017-04-14 10:40:57 -07:00
translations Extract a bunch more strings from kubectl 2017-04-06 20:12:50 -07:00
vendor Update go-restful dependency 2017-05-05 13:57:01 -07:00
.bazelrc Add verify-gofmt as a Bazel test. 2017-02-10 17:00:28 -08:00
.gazelcfg.json Add go_genrule for zz_generated.openapi.go. 2017-04-25 17:51:36 -07:00
.generated_files Move .generated_docs to docs/ so docs OWNERS can review / approve 2017-02-16 10:11:57 -08:00
.gitattributes Add -diff attributes for generated files 2016-12-08 17:12:07 -08:00
.gitignore Remove verify_gen_openapi make rule. 2017-04-25 17:41:33 -07:00
BUILD.bazel Rename //:ci-artifacts rule to //:push-build, and add a deprecated alias 2017-05-02 16:48:16 -07:00
CHANGELOG.md Update CHANGELOG.md for v1.7.0-alpha.3. 2017-05-05 19:45:25 +02:00
CONTRIBUTING.md Close kubernetes/community#420 2017-03-08 09:59:30 -08:00
LICENSE LICENSE: revert modifications to Apache license 2016-11-22 11:44:46 -08:00
Makefile skip integration test when run make bazel-test 2017-05-02 14:12:00 -07:00
Makefile.generated_files Remove verify_gen_openapi make rule. 2017-04-25 17:41:33 -07:00
OWNERS Add wojtec to global approvers 2017-01-25 11:57:00 -06:00
OWNERS_ALIASES Merge pull request #42953 from kargakis/rm-myself 2017-04-03 01:50:58 -07:00
README.md Adjust the link to the right troubleshooting doc page 2017-04-13 08:20:39 +00:00
Vagrantfile Customizable vagrant rsync args and excludes 2016-11-14 11:18:44 +01:00
WORKSPACE Update repo-infra dependency to support multiple upload paths 2017-05-03 16:05:15 -07:00
code-of-conduct.md Change code of conduct to call CNCF CoC by reference 2016-10-19 13:22:35 -04:00
labels.yaml Update labels.yaml with sig labels 2017-04-28 14:27:32 -07:00

README.md

Kubernetes

Submit Queue Widget GoDoc Widget


Kubernetes is an open source system for managing containerized applications across multiple hosts, providing basic mechanisms for deployment, maintenance, and scaling of applications.

Kubernetes builds upon a decade and a half of experience at Google running production workloads at scale using a system called Borg, combined with best-of-breed ideas and practices from the community.

Kubernetes is hosted by the Cloud Native Computing Foundation (CNCF). If you are a company that wants to help shape the evolution of technologies that are container-packaged, dynamically-scheduled and microservices-oriented, consider joining the CNCF. For details about who's involved and how Kubernetes plays a role, read the CNCF announcement.


To start using Kubernetes

See our documentation on kubernetes.io.

Try our interactive tutorial.

Take a free course on Scalable Microservices with Kubernetes.

To start developing Kubernetes

The community repository hosts all information about building Kubernetes from source, how to contribute code and documentation, who to contact about what, etc.

If you want to build Kubernetes right away there are two options:

You have a working Go environment.
$ go get -d k8s.io/kubernetes
$ cd $GOPATH/src/k8s.io/kubernetes
$ make
You have a working Docker environment.
$ git clone https://github.com/kubernetes/kubernetes
$ cd kubernetes
$ make quick-release

If you are less impatient, head over to the developer's documentation.

Support

If you need support, start with the troubleshooting guide and work your way through the process that we've outlined.

That said, if you have questions, reach out to us one way or another.

Analytics