├── .gitignore ├── LICENSE ├── README.md ├── deployments ├── README.md ├── nginx-1.17-replicas.yaml └── nginx-1.17-volume.yaml ├── persistentvolumeclaims ├── README.md └── my-pv-claim.yaml ├── services ├── README.md ├── nginx-loadbalancer.yaml └── nginx-nodeport.yaml └── storageclasses ├── README.md ├── basic.ru-1a.yaml ├── basic.ru-1b.yaml ├── fast.ru-3a.yaml └── universal.ru-9a.yaml /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/* 2 | .DS_Store 3 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Selectel 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Kubernetes examples 2 | 3 | This repository contains examples that can be used with Selectel Managed Kubernetes Service. 4 | 5 | Contents: 6 | 7 | ```tree 8 | . 9 | ├── LICENSE 10 | ├── README.md 11 | ├── deployments 12 | │ ├── README.md 13 | │ ├── nginx-1.17-replicas.yaml 14 | │ └── nginx-1.17-volume.yaml 15 | ├── persistentvolumeclaims 16 | │ ├── README.md 17 | │ └── my-pv-claim.yaml 18 | ├── services 19 | │ ├── README.md 20 | │ ├── nginx-loadbalancer.yaml 21 | │ └── nginx-nodeport.yaml 22 | └── storageclasses 23 | ├── README.md 24 | ├── basic.ru-1a.yaml 25 | ├── basic.ru-1b.yaml 26 | ├── fast.ru-3a.yaml 27 | └── universal.ru-9a.yaml 28 | ``` 29 | -------------------------------------------------------------------------------- /deployments/README.md: -------------------------------------------------------------------------------- 1 | # Deployments 2 | 3 | **Note:** You need to pre-create Persistent Volume Claim in order to use the Deployment with volume. -------------------------------------------------------------------------------- /deployments/nginx-1.17-replicas.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # nginx-1.17.yaml 3 | apiVersion: apps/v1 4 | kind: Deployment 5 | metadata: 6 | name: nginx-1.17-replicas 7 | spec: 8 | replicas: 4 9 | selector: 10 | matchLabels: 11 | app: nginx 12 | minReadySeconds: 10 13 | strategy: 14 | type: RollingUpdate 15 | rollingUpdate: 16 | maxUnavailable: 1 17 | maxSurge: 1 18 | template: 19 | metadata: 20 | labels: 21 | app: nginx 22 | spec: 23 | containers: 24 | - name: nginx 25 | image: library/nginx:1.17 26 | ports: 27 | - containerPort: 80 28 | -------------------------------------------------------------------------------- /deployments/nginx-1.17-volume.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # nginx-1.17.yaml 3 | apiVersion: apps/v1 4 | kind: Deployment 5 | metadata: 6 | name: nginx-1.17-volume 7 | spec: 8 | replicas: 1 9 | selector: 10 | matchLabels: 11 | app: nginx 12 | minReadySeconds: 10 13 | strategy: 14 | type: RollingUpdate 15 | rollingUpdate: 16 | maxUnavailable: 1 17 | maxSurge: 1 18 | template: 19 | metadata: 20 | labels: 21 | app: nginx 22 | spec: 23 | nodeSelector: 24 | topology.cinder.csi.openstack.org/zone: ru-1a 25 | containers: 26 | - name: nginx 27 | image: library/nginx:1.17 28 | ports: 29 | - containerPort: 80 30 | volumeMounts: 31 | - mountPath: "/var/www/html" 32 | name: data 33 | volumes: 34 | - name: data 35 | persistentVolumeClaim: 36 | claimName: my-pv-claim 37 | -------------------------------------------------------------------------------- /persistentvolumeclaims/README.md: -------------------------------------------------------------------------------- 1 | # Persistent Volume Claims 2 | 3 | **Note:** You should change the needed Storage Class name in the following line in the selected manifest: 4 | 5 | ```bash 6 | storageClassName: fast.ru-1a 7 | ``` -------------------------------------------------------------------------------- /persistentvolumeclaims/my-pv-claim.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # my-pv-claim.yaml 3 | apiVersion: v1 4 | kind: PersistentVolumeClaim 5 | metadata: 6 | name: my-pv-claim 7 | spec: 8 | storageClassName: fast.ru-1a 9 | accessModes: 10 | - ReadWriteOnce 11 | resources: 12 | requests: 13 | storage: 10Gi 14 | -------------------------------------------------------------------------------- /services/README.md: -------------------------------------------------------------------------------- 1 | # Services 2 | 3 | **Note:** Octavia load-balancer will be created in case of `type: LoadBalancer`. -------------------------------------------------------------------------------- /services/nginx-loadbalancer.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # nginx-loadbalancer.yaml 3 | apiVersion: v1 4 | kind: Service 5 | metadata: 6 | name: nginx-service 7 | labels: 8 | app: nginx 9 | annotations: 10 | loadbalancer.openstack.org/x-forwarded-for: "true" 11 | spec: 12 | type: LoadBalancer 13 | ports: 14 | - port: 80 15 | protocol: TCP 16 | selector: 17 | app: nginx 18 | -------------------------------------------------------------------------------- /services/nginx-nodeport.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # nginx-nodeport.yaml 3 | apiVersion: v1 4 | kind: Service 5 | metadata: 6 | name: nginx-service 7 | labels: 8 | app: nginx 9 | spec: 10 | type: NodePort 11 | ports: 12 | - port: 80 13 | nodePort: 30001 14 | protocol: TCP 15 | selector: 16 | app: nginx 17 | -------------------------------------------------------------------------------- /storageclasses/README.md: -------------------------------------------------------------------------------- 1 | # Storage Classes 2 | 3 | Provide a way to use storage for Kubernetes clusters. 4 | 5 | **Note:** Selectel Managed Kubernetes Service pre-creates Storage Classes in new clusters. 6 | 7 | You can check them with the following command: 8 | 9 | ```bash 10 | kubectl get storageclasses 11 | ``` 12 | 13 | Read more about volume types and their limits in our knowledge base: 14 | 15 | - [russian version](https://kb.selectel.ru/docs/cloud/servers/volumes/network-volumes/#лимиты) 16 | - [english version](https://kb.selectel.com/docs/cloud/servers/volumes/network_volumes/#network-volume-limits) 17 | -------------------------------------------------------------------------------- /storageclasses/basic.ru-1a.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # basic.ru-1a.yaml 3 | kind: StorageClass 4 | apiVersion: storage.k8s.io/v1 5 | metadata: 6 | name: basic.ru-1a 7 | provisioner: cinder.csi.openstack.org 8 | parameters: 9 | type: basic.ru-1a 10 | availability: ru-1a 11 | fsType: ext4 12 | allowVolumeExpansion: true 13 | -------------------------------------------------------------------------------- /storageclasses/basic.ru-1b.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # basic.ru-1b.yaml 3 | kind: StorageClass 4 | apiVersion: storage.k8s.io/v1 5 | metadata: 6 | name: basic.ru-1b 7 | provisioner: cinder.csi.openstack.org 8 | parameters: 9 | type: basic.ru-1b 10 | availability: ru-1b 11 | fsType: ext4 12 | allowVolumeExpansion: true 13 | -------------------------------------------------------------------------------- /storageclasses/fast.ru-3a.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # fast.ru-3a.yaml 3 | kind: StorageClass 4 | apiVersion: storage.k8s.io/v1 5 | metadata: 6 | name: fast.ru-3a 7 | provisioner: cinder.csi.openstack.org 8 | parameters: 9 | type: fast.ru-3a 10 | availability: ru-3a 11 | fsType: ext4 12 | allowVolumeExpansion: true 13 | -------------------------------------------------------------------------------- /storageclasses/universal.ru-9a.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # universal.ru-9a.yaml 3 | kind: StorageClass 4 | apiVersion: storage.k8s.io/v1 5 | metadata: 6 | name: universal.ru-9a 7 | provisioner: cinder.csi.openstack.org 8 | parameters: 9 | type: universal.ru-9a 10 | availability: ru-9a 11 | fsType: ext4 12 | allowVolumeExpansion: true 13 | --------------------------------------------------------------------------------