marco | acdae7e | 2015-12-02 15:35:37 +0100 | [diff] [blame] | 1 | ================== |
| 2 | Kubernetes Formula |
| 3 | ================== |
| 4 | |
Ales Komarek | 9db8af4 | 2017-06-08 11:08:05 +0200 | [diff] [blame] | 5 | Kubernetes is an open-source system for automating deployment, scaling, and |
| 6 | management of containerized applications. This formula deploys production |
Tomáš Kukrál | f1fcc27 | 2017-06-15 10:14:16 +0200 | [diff] [blame] | 7 | ready Kubernetes and generate Kubernetes manifests as well. |
marco | acdae7e | 2015-12-02 15:35:37 +0100 | [diff] [blame] | 8 | |
Tomáš Kukrál | f1fcc27 | 2017-06-15 10:14:16 +0200 | [diff] [blame] | 9 | You can download `kubectl` configuration and connect to your cluster. However, |
| 10 | keep in mind `kubernetes_control_address` needs to be accessible from your computer: |
| 11 | |
| 12 | .. code-block:: yaml |
| 13 | |
| 14 | mkdir -p ~/.kube |
| 15 | [ -f ~/.kube/config ] && cp -v ~/.kube/config ~/.kube/config-backup |
Tomáš Kukrál | 8ee2bc5 | 2017-07-31 17:51:20 +0200 | [diff] [blame] | 16 | ssh cfg01 "sudo ssh ctl01 /etc/kubernetes/kubeconfig.sh" > ~/.kube/config |
Tomáš Kukrál | f1fcc27 | 2017-06-15 10:14:16 +0200 | [diff] [blame] | 17 | kubectl get no |
| 18 | |
| 19 | |
| 20 | `cfg01` is Salt master node and `ctl01` is one of Kubernetes masters |
marco | acdae7e | 2015-12-02 15:35:37 +0100 | [diff] [blame] | 21 | |
Ales Komarek | 9db8af4 | 2017-06-08 11:08:05 +0200 | [diff] [blame] | 22 | Sample Pillars |
marco | acdae7e | 2015-12-02 15:35:37 +0100 | [diff] [blame] | 23 | ============== |
| 24 | |
Aleksei Kasatkin | 2af4892 | 2018-08-21 11:58:19 +0200 | [diff] [blame] | 25 | **REQUIRED:** Define images to use for hyperkube and Calico |
Tomáš Kukrál | 189da4b | 2017-01-18 14:30:09 +0100 | [diff] [blame] | 26 | |
| 27 | .. code-block:: yaml |
| 28 | |
| 29 | parameters: |
| 30 | kubernetes: |
| 31 | common: |
| 32 | hyperkube: |
Sergii Golovatiuk | 707f7d8 | 2017-08-07 15:49:23 +0200 | [diff] [blame] | 33 | image: gcr.io/google_containers/hyperkube:v1.6.5 |
Tomáš Kukrál | 189da4b | 2017-01-18 14:30:09 +0100 | [diff] [blame] | 34 | pool: |
| 35 | network: |
ashestakov | a7b8d35 | 2018-02-27 13:54:27 +0000 | [diff] [blame] | 36 | calico: |
| 37 | calicoctl_image: calico/ctl |
| 38 | cni_image: calico/cni |
Aleksei Kasatkin | 2af4892 | 2018-08-21 11:58:19 +0200 | [diff] [blame] | 39 | image: calico/node |
| 40 | kube_controllers_image: calico/kube-controllers |
| 41 | |
Tomáš Kukrál | 189da4b | 2017-01-18 14:30:09 +0100 | [diff] [blame] | 42 | |
Tomáš Kukrál | 25a64d7 | 2017-03-23 14:14:07 +0100 | [diff] [blame] | 43 | Enable helm-tiller addon |
Tomáš Kukrál | 1b50f77 | 2017-03-23 12:51:32 +0100 | [diff] [blame] | 44 | |
| 45 | .. code-block:: yaml |
| 46 | |
| 47 | parameters: |
| 48 | kubernetes: |
Sergii Golovatiuk | 707f7d8 | 2017-08-07 15:49:23 +0200 | [diff] [blame] | 49 | common: |
Tomáš Kukrál | 1b50f77 | 2017-03-23 12:51:32 +0100 | [diff] [blame] | 50 | addons: |
| 51 | helm: |
| 52 | enabled: true |
| 53 | |
Aleksei Kasatkin | 2af4892 | 2018-08-21 11:58:19 +0200 | [diff] [blame] | 54 | Enable calico-policy |
Matthew Mosesohn | bf9d3fb | 2017-05-17 16:17:02 +0300 | [diff] [blame] | 55 | |
| 56 | .. code-block:: yaml |
| 57 | |
| 58 | parameters: |
| 59 | kubernetes: |
Aleksei Kasatkin | 2af4892 | 2018-08-21 11:58:19 +0200 | [diff] [blame] | 60 | pool: |
| 61 | network: |
| 62 | calico: |
| 63 | policy: |
| 64 | enabled: true |
Matthew Mosesohn | bf9d3fb | 2017-05-17 16:17:02 +0300 | [diff] [blame] | 65 | |
Jakub Pavlik | c1d11e5 | 2017-06-23 11:09:20 +0200 | [diff] [blame] | 66 | Enable virtlet addon |
| 67 | |
| 68 | .. code-block:: yaml |
| 69 | |
| 70 | parameters: |
| 71 | kubernetes: |
Sergii Golovatiuk | 707f7d8 | 2017-08-07 15:49:23 +0200 | [diff] [blame] | 72 | common: |
Jakub Pavlik | c1d11e5 | 2017-06-23 11:09:20 +0200 | [diff] [blame] | 73 | addons: |
| 74 | virtlet: |
| 75 | enabled: true |
| 76 | namespace: kube-system |
Victor Ryzhenkin | 810c507 | 2018-05-26 00:03:33 +0400 | [diff] [blame] | 77 | image: mirantis/virtlet:v1.0.3 |
Jakub Pavlik | c1d11e5 | 2017-06-23 11:09:20 +0200 | [diff] [blame] | 78 | |
Tomáš Kukrál | 25a64d7 | 2017-03-23 14:14:07 +0100 | [diff] [blame] | 79 | Enable netchecker addon |
| 80 | |
| 81 | .. code-block:: yaml |
| 82 | |
| 83 | parameters: |
| 84 | kubernetes: |
Sergii Golovatiuk | 707f7d8 | 2017-08-07 15:49:23 +0200 | [diff] [blame] | 85 | common: |
| 86 | addons: |
Tomáš Kukrál | 25a64d7 | 2017-03-23 14:14:07 +0100 | [diff] [blame] | 87 | netchecker: |
| 88 | enabled: true |
Sergii Golovatiuk | 707f7d8 | 2017-08-07 15:49:23 +0200 | [diff] [blame] | 89 | master: |
| 90 | namespace: |
Tomáš Kukrál | 25a64d7 | 2017-03-23 14:14:07 +0100 | [diff] [blame] | 91 | netchecker: |
| 92 | enabled: true |
Tomáš Kukrál | 1b50f77 | 2017-03-23 12:51:32 +0100 | [diff] [blame] | 93 | |
Matthew Mosesohn | 32ec04a | 2017-07-17 19:53:47 +0300 | [diff] [blame] | 94 | Enable Kubenetes Federation control plane |
| 95 | |
| 96 | .. code-block:: yaml |
| 97 | |
| 98 | parameters: |
| 99 | kubernetes: |
| 100 | master: |
| 101 | federation: |
| 102 | enabled: True |
| 103 | name: federation |
| 104 | namespace: federation-system |
| 105 | source: https://dl.k8s.io/v1.6.6/kubernetes-client-linux-amd64.tar.gz |
| 106 | hash: 94b2c9cd29981a8e150c187193bab0d8c0b6e906260f837367feff99860a6376 |
| 107 | service_type: NodePort |
| 108 | dns_provider: coredns |
| 109 | childclusters: |
| 110 | - secondcluster.mydomain |
| 111 | - thirdcluster.mydomain |
| 112 | |
Matthew Mosesohn | 3be5dd9 | 2017-08-25 16:54:51 +0300 | [diff] [blame] | 113 | Enable external DNS addon with CoreDNS provider |
| 114 | |
| 115 | .. code-block:: yaml |
| 116 | |
| 117 | parameters: |
| 118 | kubernetes: |
| 119 | common: |
| 120 | addons: |
Sergii Golovatiuk | 08e47f3 | 2017-09-28 15:24:23 +0200 | [diff] [blame] | 121 | coredns: |
| 122 | enabled: True |
Matthew Mosesohn | 3be5dd9 | 2017-08-25 16:54:51 +0300 | [diff] [blame] | 123 | externaldns: |
Sergii Golovatiuk | 08e47f3 | 2017-09-28 15:24:23 +0200 | [diff] [blame] | 124 | enabled: True |
| 125 | domain: company.mydomain |
| 126 | provider: coredns |
Matthew Mosesohn | 3be5dd9 | 2017-08-25 16:54:51 +0300 | [diff] [blame] | 127 | |
Andrey Shestakov | 79f4af0 | 2017-09-15 21:02:55 +0300 | [diff] [blame] | 128 | Enable external DNS addon with Designate provider |
| 129 | |
| 130 | .. code-block:: yaml |
| 131 | |
| 132 | parameters: |
| 133 | kubernetes: |
| 134 | common: |
| 135 | addons: |
| 136 | externaldns: |
Sergii Golovatiuk | 08e47f3 | 2017-09-28 15:24:23 +0200 | [diff] [blame] | 137 | enabled: True |
| 138 | domain: company.mydomain |
| 139 | provider: designate |
| 140 | designate_os_options: |
| 141 | OS_AUTH_URL: https://keystone_auth_endpoint:5000 |
| 142 | OS_PROJECT_DOMAIN_NAME: default |
| 143 | OS_USER_DOMAIN_NAME: default |
| 144 | OS_PROJECT_NAME: admin |
| 145 | OS_USERNAME: admin |
| 146 | OS_PASSWORD: password |
| 147 | OS_REGION_NAME: RegionOne |
Andrey Shestakov | 79f4af0 | 2017-09-15 21:02:55 +0300 | [diff] [blame] | 148 | |
Sergii Golovatiuk | 650948c | 2017-09-25 12:00:18 +0200 | [diff] [blame] | 149 | Enable external DNS addon with AWS provider |
| 150 | |
| 151 | .. code-block:: yaml |
| 152 | |
| 153 | parameters: |
| 154 | kubernetes: |
| 155 | common: |
| 156 | addons: |
| 157 | externaldns: |
Sergii Golovatiuk | 08e47f3 | 2017-09-28 15:24:23 +0200 | [diff] [blame] | 158 | enabled: True |
| 159 | domain: company.mydomain |
| 160 | provider: aws |
| 161 | aws_options: |
| 162 | AWS_ACCESS_KEY_ID: XXXXXXXXXXXXXXXXXXXX |
| 163 | AWS_SECRET_ACCESS_KEY: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX |
| 164 | |
| 165 | Enable external DNS addon with Google CloudDNS provider |
| 166 | |
| 167 | .. code-block:: yaml |
| 168 | |
| 169 | parameters: |
| 170 | kubernetes: |
| 171 | common: |
| 172 | addons: |
| 173 | externaldns: |
| 174 | enabled: True |
| 175 | domain: company.mydomain |
| 176 | provider: google |
| 177 | google_options: |
| 178 | key: '' |
| 179 | project: default-123 |
| 180 | key should be exported from google console and processed as `cat key.json | tr -d '\n'` |
Sergii Golovatiuk | 650948c | 2017-09-25 12:00:18 +0200 | [diff] [blame] | 181 | |
Matthew Mosesohn | 1990351 | 2017-08-31 19:38:19 +0300 | [diff] [blame] | 182 | Enable OpenStack cloud provider |
| 183 | |
| 184 | .. code-block:: yaml |
| 185 | |
| 186 | parameters: |
| 187 | kubernetes: |
| 188 | common: |
| 189 | cloudprovider: |
| 190 | enabled: True |
Tomáš Kukrál | 10b1567 | 2017-09-05 10:08:46 +0200 | [diff] [blame] | 191 | provider: openstack |
Matthew Mosesohn | 1990351 | 2017-08-31 19:38:19 +0300 | [diff] [blame] | 192 | params: |
| 193 | auth_url: https://openstack.mydomain:5000/v3 |
| 194 | username: nova |
| 195 | password: nova |
| 196 | region: RegionOne |
| 197 | tenant_id: 4bce4162d8744c599e350099cfa22a0a |
| 198 | domain_name: default |
| 199 | subnet_id: 72407854-aca6-4cf1-b873-e9affb09484b |
| 200 | lb_version: v2 |
| 201 | |
Tomáš Kukrál | f78baa6 | 2017-04-20 16:18:16 +0200 | [diff] [blame] | 202 | Configure service verbosity |
| 203 | |
| 204 | .. code-block:: yaml |
| 205 | |
| 206 | parameters: |
| 207 | kubernetes: |
| 208 | master: |
| 209 | verbosity: 2 |
| 210 | pool: |
| 211 | verbosity: 2 |
| 212 | |
Matthew Mosesohn | 32ec04a | 2017-07-17 19:53:47 +0300 | [diff] [blame] | 213 | Set cluster name and domain |
Matthew Mosesohn | 0f7bee4 | 2017-07-17 13:52:16 +0300 | [diff] [blame] | 214 | |
| 215 | .. code-block:: yaml |
| 216 | |
| 217 | parameters: |
| 218 | kubernetes: |
| 219 | common: |
| 220 | kubernetes_cluster_domain: mycluster.domain |
Matthew Mosesohn | 32ec04a | 2017-07-17 19:53:47 +0300 | [diff] [blame] | 221 | cluster_name : mycluster |
Matthew Mosesohn | 0f7bee4 | 2017-07-17 13:52:16 +0300 | [diff] [blame] | 222 | |
Tomáš Kukrál | aff3526 | 2017-04-18 12:37:45 +0200 | [diff] [blame] | 223 | Enable autoscaler for dns addon. Poll period can be skipped. |
| 224 | |
| 225 | .. code-block:: yaml |
| 226 | |
| 227 | kubernetes: |
Sergii Golovatiuk | 707f7d8 | 2017-08-07 15:49:23 +0200 | [diff] [blame] | 228 | common: |
Tomáš Kukrál | aff3526 | 2017-04-18 12:37:45 +0200 | [diff] [blame] | 229 | addons: |
| 230 | dns: |
| 231 | domain: cluster.local |
| 232 | enabled: true |
| 233 | replicas: 1 |
| 234 | server: 10.254.0.10 |
| 235 | autoscaler: |
| 236 | enabled: true |
| 237 | poll-period-seconds: 60 |
| 238 | |
| 239 | |
Tomáš Kukrál | 6ef3f89 | 2017-02-15 12:02:22 +0100 | [diff] [blame] | 240 | Pass aditional parameters to daemons: |
| 241 | |
| 242 | .. code-block:: yaml |
| 243 | |
| 244 | parameters: |
| 245 | kubernetes: |
| 246 | master: |
| 247 | apiserver: |
| 248 | daemon_opts: |
| 249 | storage-backend: pigeon |
| 250 | controller_manager: |
| 251 | daemon_opts: |
| 252 | log-dir: /dev/nulL |
| 253 | pool: |
| 254 | kubelet: |
| 255 | daemon_opts: |
| 256 | max-pods: "6" |
| 257 | |
Tomáš Kukrál | 189da4b | 2017-01-18 14:30:09 +0100 | [diff] [blame] | 258 | |
Ales Komarek | 688a04c | 2016-07-15 15:12:30 +0200 | [diff] [blame] | 259 | Containers on pool definitions in pool.service.local |
| 260 | |
Jakub Pavlik | 7e98532 | 2016-07-17 13:16:15 +0200 | [diff] [blame] | 261 | .. code-block:: yaml |
| 262 | |
| 263 | parameters: |
| 264 | kubernetes: |
| 265 | pool: |
| 266 | service: |
| 267 | local: |
| 268 | enabled: False |
| 269 | service: libvirt |
| 270 | cluster: openstack-compute |
| 271 | namespace: default |
| 272 | role: ${linux:system:name} |
| 273 | type: LoadBalancer |
| 274 | kind: Deployment |
| 275 | apiVersion: extensions/v1beta1 |
| 276 | replicas: 1 |
| 277 | host_pid: True |
| 278 | nodeSelector: |
| 279 | - key: openstack |
| 280 | value: ${linux:system:name} |
| 281 | hostNetwork: True |
| 282 | container: |
| 283 | libvirt-compute: |
| 284 | privileged: True |
| 285 | image: ${_param:docker_repository}/libvirt-compute |
| 286 | tag: ${_param:openstack_container_tag} |
Ales Komarek | 688a04c | 2016-07-15 15:12:30 +0200 | [diff] [blame] | 287 | |
| 288 | Master definition |
| 289 | |
marco | acdae7e | 2015-12-02 15:35:37 +0100 | [diff] [blame] | 290 | .. code-block:: yaml |
| 291 | |
| 292 | kubernetes: |
Sergii Golovatiuk | 707f7d8 | 2017-08-07 15:49:23 +0200 | [diff] [blame] | 293 | common: |
Matthew Mosesohn | 32ec04a | 2017-07-17 19:53:47 +0300 | [diff] [blame] | 294 | cluster_name: cluster |
Jakub Pavlik | 495d06f | 2016-06-17 11:33:05 +0200 | [diff] [blame] | 295 | addons: |
| 296 | dns: |
| 297 | domain: cluster.local |
| 298 | enabled: true |
| 299 | replicas: 1 |
| 300 | server: 10.254.0.10 |
Sergii Golovatiuk | 707f7d8 | 2017-08-07 15:49:23 +0200 | [diff] [blame] | 301 | master: |
Jakub Pavlik | 495d06f | 2016-06-17 11:33:05 +0200 | [diff] [blame] | 302 | admin: |
| 303 | password: password |
| 304 | username: admin |
| 305 | apiserver: |
| 306 | address: 10.0.175.100 |
Swann Croiset | ff97efc | 2017-02-23 13:32:33 +0100 | [diff] [blame] | 307 | secure_port: 443 |
| 308 | insecure_address: 127.0.0.1 |
| 309 | insecure_port: 8080 |
Jakub Pavlik | 495d06f | 2016-06-17 11:33:05 +0200 | [diff] [blame] | 310 | ca: kubernetes |
| 311 | enabled: true |
| 312 | etcd: |
| 313 | host: 127.0.0.1 |
| 314 | members: |
| 315 | - host: 10.0.175.100 |
| 316 | name: node040 |
| 317 | name: node040 |
| 318 | token: ca939ec9c2a17b0786f6d411fe019e9b |
| 319 | kubelet: |
| 320 | allow_privileged: true |
| 321 | network: |
Andrey Shestakov | d389a5a | 2018-03-12 18:00:52 +0200 | [diff] [blame] | 322 | calico: |
| 323 | enabled: true |
Jakub Pavlik | 495d06f | 2016-06-17 11:33:05 +0200 | [diff] [blame] | 324 | service_addresses: 10.254.0.0/16 |
| 325 | storage: |
| 326 | engine: glusterfs |
| 327 | members: |
| 328 | - host: 10.0.175.101 |
| 329 | port: 24007 |
| 330 | - host: 10.0.175.102 |
| 331 | port: 24007 |
| 332 | - host: 10.0.175.103 |
| 333 | port: 24007 |
| 334 | port: 24007 |
| 335 | token: |
| 336 | admin: DFvQ8GJ9JD4fKNfuyEddw3rjnFTkUKsv |
| 337 | controller_manager: EreGh6AnWf8DxH8cYavB2zS029PUi7vx |
| 338 | dns: RAFeVSE4UvsCz4gk3KYReuOI5jsZ1Xt3 |
| 339 | kube_proxy: DFvQ8GelB7afH3wClC9romaMPhquyyEe |
| 340 | kubelet: 7bN5hJ9JD4fKjnFTkUKsvVNfuyEddw3r |
| 341 | logging: MJkXKdbgqRmTHSa2ykTaOaMykgO6KcEf |
| 342 | monitoring: hnsj0XqABgrSww7Nqo7UVTSZLJUt2XRd |
| 343 | scheduler: HY1UUxEPpmjW4a1dDLGIANYQp1nZkLDk |
| 344 | version: v1.2.4 |
| 345 | |
marco | acdae7e | 2015-12-02 15:35:37 +0100 | [diff] [blame] | 346 | |
| 347 | kubernetes: |
Jakub Pavlik | 495d06f | 2016-06-17 11:33:05 +0200 | [diff] [blame] | 348 | pool: |
| 349 | address: 0.0.0.0 |
| 350 | allow_privileged: true |
| 351 | ca: kubernetes |
| 352 | cluster_dns: 10.254.0.10 |
| 353 | cluster_domain: cluster.local |
| 354 | enabled: true |
| 355 | kubelet: |
| 356 | allow_privileged: true |
| 357 | config: /etc/kubernetes/manifests |
| 358 | frequency: 5s |
| 359 | master: |
| 360 | apiserver: |
| 361 | members: |
| 362 | - host: 10.0.175.100 |
| 363 | etcd: |
| 364 | members: |
| 365 | - host: 10.0.175.100 |
| 366 | host: 10.0.175.100 |
| 367 | network: |
Andrey Shestakov | d389a5a | 2018-03-12 18:00:52 +0200 | [diff] [blame] | 368 | calico: |
| 369 | enabled: true |
Jakub Pavlik | 495d06f | 2016-06-17 11:33:05 +0200 | [diff] [blame] | 370 | token: |
| 371 | kube_proxy: DFvQ8GelB7afH3wClC9romaMPhquyyEe |
| 372 | kubelet: 7bN5hJ9JD4fKjnFTkUKsvVNfuyEddw3r |
| 373 | version: v1.2.4 |
marco | acdae7e | 2015-12-02 15:35:37 +0100 | [diff] [blame] | 374 | |
Tomáš Kukrál | bc3623e | 2017-03-23 18:24:06 +0100 | [diff] [blame] | 375 | |
Filip Pytloun | 1e16307 | 2017-10-16 17:26:48 +0200 | [diff] [blame] | 376 | Enable basic, token and http authentication, disable ssl auth, create some |
| 377 | static users: |
| 378 | |
| 379 | .. code-block:: yaml |
| 380 | |
| 381 | kubernetes: |
| 382 | master: |
| 383 | auth: |
| 384 | basic: |
| 385 | enabled: true |
| 386 | user: |
| 387 | jdoe: |
| 388 | password: dummy |
| 389 | groups: |
| 390 | - system:admin |
| 391 | http: |
| 392 | enabled: true |
| 393 | header: |
| 394 | user: X-Remote-User |
| 395 | group: X-Remote-Group |
| 396 | ssl: |
| 397 | enabled: false |
| 398 | token: |
| 399 | enabled: true |
| 400 | user: |
| 401 | jdoe: |
| 402 | token: dummytoken |
| 403 | groups: |
| 404 | - system:admin |
| 405 | |
Jakub Pavlik | 495d06f | 2016-06-17 11:33:05 +0200 | [diff] [blame] | 406 | Kubernetes with OpenContrail network plugin |
| 407 | ------------------------------------------------ |
marco | acdae7e | 2015-12-02 15:35:37 +0100 | [diff] [blame] | 408 | |
| 409 | On Master: |
| 410 | |
| 411 | .. code-block:: yaml |
| 412 | |
| 413 | kubernetes: |
Sergii Golovatiuk | 707f7d8 | 2017-08-07 15:49:23 +0200 | [diff] [blame] | 414 | master: |
marco | acdae7e | 2015-12-02 15:35:37 +0100 | [diff] [blame] | 415 | network: |
Andrey Shestakov | d389a5a | 2018-03-12 18:00:52 +0200 | [diff] [blame] | 416 | opencontrail: |
| 417 | enabled: true |
ashestakov | e19660a | 2018-03-05 12:43:30 +0000 | [diff] [blame] | 418 | default_domain: default-domain |
| 419 | default_project: default-domain:default-project |
| 420 | public_network: default-domain:default-project:Public |
| 421 | public_ip_range: 185.22.97.128/26 |
| 422 | private_ip_range: 10.150.0.0/16 |
| 423 | service_cluster_ip_range: 10.254.0.0/16 |
| 424 | network_label: name |
| 425 | service_label: uses |
| 426 | cluster_service: kube-system/default |
| 427 | config: |
| 428 | api: |
| 429 | host: 10.0.170.70 |
marco | acdae7e | 2015-12-02 15:35:37 +0100 | [diff] [blame] | 430 | On pools: |
| 431 | |
| 432 | .. code-block:: yaml |
| 433 | |
| 434 | kubernetes: |
| 435 | pool: |
| 436 | network: |
Andrey Shestakov | d389a5a | 2018-03-12 18:00:52 +0200 | [diff] [blame] | 437 | opencontrail: |
| 438 | enabled: true |
marco | acdae7e | 2015-12-02 15:35:37 +0100 | [diff] [blame] | 439 | |
Tomáš Kukrál | 13b1edb | 2017-06-08 16:47:34 +0200 | [diff] [blame] | 440 | |
| 441 | Dashboard public IP must be configured when Contrail network is used: |
| 442 | |
| 443 | .. code-block:: yaml |
| 444 | |
| 445 | kubernetes: |
Sergii Golovatiuk | 707f7d8 | 2017-08-07 15:49:23 +0200 | [diff] [blame] | 446 | common: |
Tomáš Kukrál | 13b1edb | 2017-06-08 16:47:34 +0200 | [diff] [blame] | 447 | addons: |
Alexander Noskov | 0637cd6 | 2018-02-16 13:49:11 +0400 | [diff] [blame] | 448 | dashboard: |
| 449 | public_ip: 1.1.1.1 |
Tomáš Kukrál | 13b1edb | 2017-06-08 16:47:34 +0200 | [diff] [blame] | 450 | |
Jakub Pavlik | 1cfc1fe | 2016-07-25 11:01:52 +0200 | [diff] [blame] | 451 | Kubernetes control plane running in systemd |
| 452 | ------------------------------------------- |
| 453 | |
Matthew Mosesohn | bf9d3fb | 2017-05-17 16:17:02 +0300 | [diff] [blame] | 454 | By default kube-apiserver, kube-scheduler, kube-controllermanager, kube-proxy, etcd running in docker containers through manifests. For stable production environment this should be run in systemd. |
Jakub Pavlik | 1cfc1fe | 2016-07-25 11:01:52 +0200 | [diff] [blame] | 455 | |
| 456 | .. code-block:: yaml |
| 457 | |
| 458 | kubernetes: |
| 459 | master: |
| 460 | container: false |
| 461 | |
| 462 | kubernetes: |
| 463 | pool: |
| 464 | container: false |
| 465 | |
marco | 055ff85 | 2016-07-27 15:22:33 +0200 | [diff] [blame] | 466 | Because k8s services run under kube user without root privileges, there is need to change secure port for apiserver. |
| 467 | |
| 468 | .. code-block:: yaml |
| 469 | |
| 470 | kubernetes: |
| 471 | master: |
| 472 | apiserver: |
| 473 | secure_port: 8081 |
| 474 | |
Andrey Shestakov | e3cf006 | 2018-06-19 15:04:33 +0300 | [diff] [blame] | 475 | Kubernetes with MetalLB |
| 476 | ----------------------- |
| 477 | |
| 478 | On Master: |
| 479 | |
| 480 | .. code-block:: yaml |
| 481 | |
| 482 | kubernetes: |
| 483 | common: |
| 484 | addons: |
| 485 | metallb: |
| 486 | enabled: true |
| 487 | addresses: |
| 488 | - 172.16.10.150-172.16.10.180 |
| 489 | - 172.16.10.192/26 |
| 490 | |
Andrey Shestakov | b305797 | 2018-06-25 17:50:23 +0300 | [diff] [blame] | 491 | Kubernetes with SRIOV |
| 492 | ----------------------- |
| 493 | |
| 494 | On Master: |
| 495 | |
| 496 | .. code-block:: yaml |
| 497 | |
| 498 | kubernetes: |
| 499 | master: |
| 500 | network: |
| 501 | sriov: |
| 502 | enabled: true |
| 503 | interface: eno2 |
| 504 | subnet: 10.55.208.0/24 |
| 505 | gateway: 10.55.208.1 |
| 506 | |
| 507 | On pools: |
| 508 | |
| 509 | .. code-block:: yaml |
| 510 | |
| 511 | kubernetes: |
| 512 | pool: |
| 513 | network: |
| 514 | sriov: |
| 515 | enabled: true |
| 516 | interface: eno2 |
| 517 | subnet: 10.55.208.0/24 |
| 518 | gateway: 10.55.208.1 |
| 519 | |
marco | acdae7e | 2015-12-02 15:35:37 +0100 | [diff] [blame] | 520 | Kubernetes with Flannel |
| 521 | ----------------------- |
| 522 | |
| 523 | On Master: |
| 524 | |
| 525 | .. code-block:: yaml |
| 526 | |
| 527 | kubernetes: |
| 528 | master: |
| 529 | network: |
Andrey Shestakov | d389a5a | 2018-03-12 18:00:52 +0200 | [diff] [blame] | 530 | flannel: |
| 531 | enabled: true |
marco | acdae7e | 2015-12-02 15:35:37 +0100 | [diff] [blame] | 532 | |
| 533 | On pools: |
| 534 | |
| 535 | .. code-block:: yaml |
| 536 | |
| 537 | kubernetes: |
| 538 | pool: |
| 539 | network: |
Andrey Shestakov | d389a5a | 2018-03-12 18:00:52 +0200 | [diff] [blame] | 540 | flannel: |
| 541 | enabled: true |
marco | acdae7e | 2015-12-02 15:35:37 +0100 | [diff] [blame] | 542 | |
| 543 | Kubernetes with Calico |
| 544 | ----------------------- |
| 545 | |
| 546 | On Master: |
| 547 | |
| 548 | .. code-block:: yaml |
| 549 | |
| 550 | kubernetes: |
| 551 | master: |
| 552 | network: |
ashestakov | a7b8d35 | 2018-02-27 13:54:27 +0000 | [diff] [blame] | 553 | calico: |
Andrey Shestakov | d389a5a | 2018-03-12 18:00:52 +0200 | [diff] [blame] | 554 | enabled: true |
ashestakov | a7b8d35 | 2018-02-27 13:54:27 +0000 | [diff] [blame] | 555 | mtu: 1500 |
Jakub Pavlik | 7e98532 | 2016-07-17 13:16:15 +0200 | [diff] [blame] | 556 | # If you don't register master as node: |
ashestakov | a7b8d35 | 2018-02-27 13:54:27 +0000 | [diff] [blame] | 557 | etcd: |
| 558 | members: |
| 559 | - host: 10.0.175.101 |
| 560 | port: 4001 |
| 561 | - host: 10.0.175.102 |
| 562 | port: 4001 |
| 563 | - host: 10.0.175.103 |
| 564 | port: 4001 |
marco | acdae7e | 2015-12-02 15:35:37 +0100 | [diff] [blame] | 565 | |
| 566 | On pools: |
| 567 | |
| 568 | .. code-block:: yaml |
| 569 | |
| 570 | kubernetes: |
| 571 | pool: |
| 572 | network: |
ashestakov | a7b8d35 | 2018-02-27 13:54:27 +0000 | [diff] [blame] | 573 | calico: |
Andrey Shestakov | d389a5a | 2018-03-12 18:00:52 +0200 | [diff] [blame] | 574 | enabled: true |
ashestakov | a7b8d35 | 2018-02-27 13:54:27 +0000 | [diff] [blame] | 575 | mtu: 1500 |
| 576 | etcd: |
| 577 | members: |
| 578 | - host: 10.0.175.101 |
| 579 | port: 4001 |
| 580 | - host: 10.0.175.102 |
| 581 | port: 4001 |
| 582 | - host: 10.0.175.103 |
| 583 | port: 4001 |
marco | acdae7e | 2015-12-02 15:35:37 +0100 | [diff] [blame] | 584 | |
Tomáš Kukrál | 34c5936 | 2017-03-01 14:00:37 +0100 | [diff] [blame] | 585 | Running with secured etcd: |
| 586 | |
| 587 | .. code-block:: yaml |
| 588 | |
| 589 | kubernetes: |
| 590 | pool: |
| 591 | network: |
ashestakov | a7b8d35 | 2018-02-27 13:54:27 +0000 | [diff] [blame] | 592 | calico: |
Andrey Shestakov | d389a5a | 2018-03-12 18:00:52 +0200 | [diff] [blame] | 593 | enabled: true |
ashestakov | a7b8d35 | 2018-02-27 13:54:27 +0000 | [diff] [blame] | 594 | etcd: |
| 595 | ssl: |
| 596 | enabled: true |
Tomáš Kukrál | 34c5936 | 2017-03-01 14:00:37 +0100 | [diff] [blame] | 597 | master: |
| 598 | network: |
ashestakov | a7b8d35 | 2018-02-27 13:54:27 +0000 | [diff] [blame] | 599 | calico: |
Andrey Shestakov | d389a5a | 2018-03-12 18:00:52 +0200 | [diff] [blame] | 600 | enabled: true |
ashestakov | a7b8d35 | 2018-02-27 13:54:27 +0000 | [diff] [blame] | 601 | etcd: |
| 602 | ssl: |
| 603 | enabled: true |
Tomáš Kukrál | 34c5936 | 2017-03-01 14:00:37 +0100 | [diff] [blame] | 604 | |
Aleksei Kasatkin | 2af4892 | 2018-08-21 11:58:19 +0200 | [diff] [blame] | 605 | Running with calico-policy: |
Matthew Mosesohn | bf9d3fb | 2017-05-17 16:17:02 +0300 | [diff] [blame] | 606 | |
| 607 | .. code-block:: yaml |
| 608 | |
| 609 | kubernetes: |
| 610 | pool: |
| 611 | network: |
Andrey Shestakov | d389a5a | 2018-03-12 18:00:52 +0200 | [diff] [blame] | 612 | calico: |
| 613 | enabled: true |
Aleksei Kasatkin | 2af4892 | 2018-08-21 11:58:19 +0200 | [diff] [blame] | 614 | policy: |
Matthew Mosesohn | bf9d3fb | 2017-05-17 16:17:02 +0300 | [diff] [blame] | 615 | enabled: true |
| 616 | |
| 617 | master: |
| 618 | network: |
Andrey Shestakov | d389a5a | 2018-03-12 18:00:52 +0200 | [diff] [blame] | 619 | calico: |
| 620 | enabled: true |
Aleksei Kasatkin | 2af4892 | 2018-08-21 11:58:19 +0200 | [diff] [blame] | 621 | policy: |
Matthew Mosesohn | bf9d3fb | 2017-05-17 16:17:02 +0300 | [diff] [blame] | 622 | enabled: true |
| 623 | |
| 624 | |
| 625 | |
Tomáš Kukrál | 7e91a94 | 2017-03-23 16:02:52 +0100 | [diff] [blame] | 626 | Enable Prometheus metrics in Felix |
| 627 | |
| 628 | .. code-block:: yaml |
| 629 | |
| 630 | kubernetes: |
| 631 | pool: |
| 632 | network: |
ashestakov | a7b8d35 | 2018-02-27 13:54:27 +0000 | [diff] [blame] | 633 | calico: |
| 634 | prometheus: |
| 635 | enabled: true |
Tomáš Kukrál | 7e91a94 | 2017-03-23 16:02:52 +0100 | [diff] [blame] | 636 | master: |
| 637 | network: |
ashestakov | a7b8d35 | 2018-02-27 13:54:27 +0000 | [diff] [blame] | 638 | calico: |
| 639 | prometheus: |
| 640 | enabled: true |
Tomáš Kukrál | 7e91a94 | 2017-03-23 16:02:52 +0100 | [diff] [blame] | 641 | |
Jakub Pavlik | 7e98532 | 2016-07-17 13:16:15 +0200 | [diff] [blame] | 642 | Post deployment configuration |
| 643 | |
| 644 | .. code-block:: bash |
Jakub Pavlik | 232833c | 2016-07-17 13:21:00 +0200 | [diff] [blame] | 645 | |
Jakub Pavlik | 7e98532 | 2016-07-17 13:16:15 +0200 | [diff] [blame] | 646 | # set ETCD |
| 647 | export ETCD_AUTHORITY=10.0.111.201:4001 |
| 648 | |
| 649 | # Set NAT for pods subnet |
| 650 | calicoctl pool add 192.168.0.0/16 --nat-outgoing |
| 651 | |
| 652 | # Status commands |
| 653 | calicoctl status |
| 654 | calicoctl node show |
| 655 | |
Jakub Pavlik | 495d06f | 2016-06-17 11:33:05 +0200 | [diff] [blame] | 656 | Kubernetes with GlusterFS for storage |
| 657 | --------------------------------------------- |
| 658 | |
| 659 | .. code-block:: yaml |
| 660 | |
| 661 | kubernetes: |
Tomáš Kukrál | 4f0dae3 | 2017-03-21 19:04:19 +0100 | [diff] [blame] | 662 | master: |
Jakub Pavlik | 495d06f | 2016-06-17 11:33:05 +0200 | [diff] [blame] | 663 | ... |
| 664 | storage: |
| 665 | engine: glusterfs |
| 666 | port: 24007 |
| 667 | members: |
| 668 | - host: 10.0.175.101 |
| 669 | port: 24007 |
| 670 | - host: 10.0.175.102 |
| 671 | port: 24007 |
| 672 | - host: 10.0.175.103 |
| 673 | port: 24007 |
| 674 | ... |
| 675 | |
Jakub Pavlik | 5b043a2 | 2017-09-05 09:33:58 +0200 | [diff] [blame] | 676 | Kubernetes Storage Class |
| 677 | ------------------------ |
| 678 | |
| 679 | AWS EBS storageclass integration. It also requires to create IAM policy and profiles for instances and tag all resources by KubernetesCluster in EC2. |
| 680 | |
| 681 | .. code-block:: yaml |
| 682 | |
| 683 | kubernetes: |
| 684 | common: |
| 685 | addons: |
| 686 | storageclass: |
| 687 | aws_slow: |
Jakub Pavlik | 5b043a2 | 2017-09-05 09:33:58 +0200 | [diff] [blame] | 688 | enabled: True |
| 689 | default: True |
| 690 | provisioner: aws-ebs |
Petr Michalec | 52d4e1f | 2017-09-11 17:50:54 +0200 | [diff] [blame] | 691 | name: slow |
Jakub Pavlik | 5b043a2 | 2017-09-05 09:33:58 +0200 | [diff] [blame] | 692 | type: gp2 |
| 693 | iopspergb: "10" |
| 694 | zones: xxx |
Petr Michalec | 52d4e1f | 2017-09-11 17:50:54 +0200 | [diff] [blame] | 695 | nfs_shared: |
| 696 | name: elasti01 |
| 697 | enabled: True |
| 698 | provisioner: nfs |
| 699 | spec: |
| 700 | name: elastic_data |
| 701 | nfs: |
| 702 | server: 10.0.0.1 |
| 703 | path: /exported_path |
Jakub Pavlik | 5b043a2 | 2017-09-05 09:33:58 +0200 | [diff] [blame] | 704 | |
Andrey Shestakov | 0627804 | 2018-09-07 12:43:25 +0300 | [diff] [blame] | 705 | Ceph RBD storageclass integration. |
| 706 | |
| 707 | .. code-block:: yaml |
| 708 | |
| 709 | kubernetes: |
| 710 | common: |
| 711 | addons: |
| 712 | storageclass: |
| 713 | rbd: |
| 714 | enabled: True |
| 715 | default: True |
| 716 | provisioner: rbd |
| 717 | name: rbd |
| 718 | user_id: kubernetes |
| 719 | user_key: AQAOoo5bGqtPExAABGSPtThpt5s+iq97KAE+WQ== |
| 720 | monitors: cmn01:6789,cmn02:6789,cmn03:6789 |
| 721 | pool: kubernetes |
| 722 | fstype: ext4 |
| 723 | |
marco | 45fc1b7 | 2016-07-02 16:11:18 +0200 | [diff] [blame] | 724 | Kubernetes namespaces |
| 725 | --------------------- |
| 726 | |
| 727 | Create namespace: |
| 728 | |
| 729 | .. code-block:: yaml |
| 730 | |
| 731 | kubernetes: |
Tomáš Kukrál | 4f0dae3 | 2017-03-21 19:04:19 +0100 | [diff] [blame] | 732 | master: |
marco | 45fc1b7 | 2016-07-02 16:11:18 +0200 | [diff] [blame] | 733 | ... |
| 734 | namespace: |
| 735 | kube-system: |
| 736 | enabled: True |
| 737 | namespace2: |
| 738 | enabled: True |
| 739 | namespace3: |
| 740 | enabled: False |
| 741 | ... |
| 742 | |
| 743 | Kubernetes labels |
| 744 | ----------------- |
| 745 | |
Marek Celoud | 901020b | 2017-01-27 14:51:41 +0100 | [diff] [blame] | 746 | Label node: |
marco | 45fc1b7 | 2016-07-02 16:11:18 +0200 | [diff] [blame] | 747 | |
| 748 | .. code-block:: yaml |
| 749 | |
Marek Celoud | 901020b | 2017-01-27 14:51:41 +0100 | [diff] [blame] | 750 | kubernetes: |
| 751 | master: |
| 752 | label: |
| 753 | label01: |
| 754 | value: value01 |
| 755 | node: node01 |
| 756 | enabled: true |
| 757 | key: key01 |
marco | 45fc1b7 | 2016-07-02 16:11:18 +0200 | [diff] [blame] | 758 | ... |
marco | 45fc1b7 | 2016-07-02 16:11:18 +0200 | [diff] [blame] | 759 | |
marco | f7efecb | 2016-07-16 16:13:37 +0200 | [diff] [blame] | 760 | Pull images from private registries |
| 761 | ----------------------------------- |
| 762 | |
| 763 | .. code-block:: yaml |
| 764 | |
| 765 | kubernetes: |
Tomáš Kukrál | 4f0dae3 | 2017-03-21 19:04:19 +0100 | [diff] [blame] | 766 | master: |
marco | f7efecb | 2016-07-16 16:13:37 +0200 | [diff] [blame] | 767 | ... |
| 768 | registry: |
| 769 | secret: |
| 770 | registry01: |
| 771 | enabled: True |
| 772 | key: (get from `cat /root/.docker/config.json | base64`) |
| 773 | namespace: default |
| 774 | ... |
| 775 | control: |
| 776 | ... |
| 777 | service: |
| 778 | service01: |
| 779 | ... |
| 780 | image_pull_secretes: registry01 |
| 781 | ... |
| 782 | |
Jakub Pavlik | 495d06f | 2016-06-17 11:33:05 +0200 | [diff] [blame] | 783 | Kubernetes Service Definitions in pillars |
| 784 | ========================================== |
| 785 | |
| 786 | Following samples show how to generate kubernetes manifest as well and provide single tool for complete infrastructure management. |
| 787 | |
| 788 | Deployment manifest |
| 789 | --------------------- |
marco | acdae7e | 2015-12-02 15:35:37 +0100 | [diff] [blame] | 790 | |
| 791 | .. code-block:: yaml |
| 792 | |
| 793 | salt: |
| 794 | control: |
| 795 | enabled: True |
| 796 | hostNetwork: True |
| 797 | service: |
| 798 | memcached: |
| 799 | privileged: True |
| 800 | service: memcached |
| 801 | role: server |
| 802 | type: LoadBalancer |
| 803 | replicas: 3 |
| 804 | kind: Deployment |
| 805 | apiVersion: extensions/v1beta1 |
| 806 | ports: |
| 807 | - port: 8774 |
| 808 | name: nova-api |
| 809 | - port: 8775 |
| 810 | name: nova-metadata |
| 811 | volume: |
| 812 | volume_name: |
| 813 | type: hostPath |
| 814 | mount: /certs |
| 815 | path: /etc/certs |
| 816 | container: |
| 817 | memcached: |
| 818 | image: memcached |
| 819 | tag:2 |
| 820 | ports: |
| 821 | - port: 8774 |
| 822 | name: nova-api |
| 823 | - port: 8775 |
| 824 | name: nova-metadata |
| 825 | variables: |
| 826 | - name: HTTP_TLS_CERTIFICATE: |
| 827 | value: /certs/domain.crt |
| 828 | - name: HTTP_TLS_KEY |
| 829 | value: /certs/domain.key |
| 830 | volumes: |
| 831 | - name: /etc/certs |
| 832 | type: hostPath |
| 833 | mount: /certs |
| 834 | path: /etc/certs |
| 835 | |
marco | be30c8d | 2016-10-11 19:16:35 +0200 | [diff] [blame] | 836 | PetSet manifest |
| 837 | --------------------- |
| 838 | |
| 839 | .. code-block:: yaml |
| 840 | |
| 841 | service: |
| 842 | memcached: |
| 843 | apiVersion: apps/v1alpha1 |
| 844 | kind: PetSet |
| 845 | service_name: 'memcached' |
| 846 | container: |
| 847 | memcached: |
| 848 | ... |
| 849 | |
| 850 | |
Filip Pytloun | 9a4a40f | 2016-09-22 16:28:19 +0200 | [diff] [blame] | 851 | Configmap |
| 852 | --------- |
| 853 | |
| 854 | You are able to create configmaps using support layer between formulas. |
| 855 | It works simple, eg. in nova formula there's file ``meta/config.yml`` which |
| 856 | defines config files used by that service and roles. |
| 857 | |
| 858 | Kubernetes formula is able to generate these files using custom pillar and |
| 859 | grains structure. This way you are able to run docker images built by any way |
| 860 | while still re-using your configuration management. |
| 861 | |
| 862 | Example pillar: |
| 863 | |
| 864 | .. code-block:: bash |
| 865 | |
| 866 | kubernetes: |
| 867 | control: |
Jakub Pavlik | a277972 | 2016-11-25 15:35:26 +0100 | [diff] [blame] | 868 | config_type: default|kubernetes # Output is yaml k8s or default single files |
Filip Pytloun | 9a4a40f | 2016-09-22 16:28:19 +0200 | [diff] [blame] | 869 | configmap: |
| 870 | nova-control: |
| 871 | grains: |
| 872 | # Alternate grains as OS running in container may differ from |
| 873 | # salt minion OS. Needed only if grains matters for config |
| 874 | # generation. |
| 875 | os_family: Debian |
| 876 | pillar: |
| 877 | # Generic pillar for nova controller |
| 878 | nova: |
| 879 | controller: |
| 880 | enabled: true |
| 881 | versionn: liberty |
| 882 | ... |
| 883 | |
| 884 | To tell which services supports config generation, you need to ensure pillar |
| 885 | structure like this to determine support: |
| 886 | |
| 887 | .. code-block:: yaml |
| 888 | |
| 889 | nova: |
| 890 | _support: |
| 891 | config: |
| 892 | enabled: true |
| 893 | |
marco | d4d3dbd | 2016-09-27 11:36:40 +0200 | [diff] [blame] | 894 | initContainers |
| 895 | -------------- |
| 896 | |
| 897 | Example pillar: |
| 898 | |
| 899 | .. code-block:: bash |
| 900 | |
| 901 | kubernetes: |
| 902 | control: |
| 903 | service: |
| 904 | memcached: |
| 905 | init_containers: |
| 906 | - name: test-mysql |
| 907 | image: busybox |
| 908 | command: |
| 909 | - sleep |
| 910 | - 3600 |
| 911 | volumes: |
| 912 | - name: config |
| 913 | mount: /test |
| 914 | - name: test-memcached |
| 915 | image: busybox |
| 916 | command: |
| 917 | - sleep |
| 918 | - 3600 |
| 919 | volumes: |
| 920 | - name: config |
| 921 | mount: /test |
| 922 | |
marco | ee859d3 | 2016-11-07 11:04:57 +0100 | [diff] [blame] | 923 | Affinity |
| 924 | -------- |
| 925 | |
| 926 | podAffinity |
| 927 | =========== |
| 928 | |
| 929 | Example pillar: |
| 930 | |
| 931 | .. code-block:: bash |
| 932 | |
| 933 | kubernetes: |
| 934 | control: |
| 935 | service: |
| 936 | memcached: |
| 937 | affinity: |
| 938 | pod_affinity: |
| 939 | name: podAffinity |
| 940 | expression: |
| 941 | label_selector: |
| 942 | name: labelSelector |
| 943 | selectors: |
| 944 | - key: app |
| 945 | value: memcached |
| 946 | topology_key: kubernetes.io/hostname |
| 947 | |
| 948 | podAntiAffinity |
| 949 | =============== |
| 950 | |
| 951 | Example pillar: |
| 952 | |
| 953 | .. code-block:: bash |
| 954 | |
| 955 | kubernetes: |
| 956 | control: |
| 957 | service: |
| 958 | memcached: |
| 959 | affinity: |
| 960 | anti_affinity: |
| 961 | name: podAntiAffinity |
| 962 | expression: |
| 963 | label_selector: |
| 964 | name: labelSelector |
| 965 | selectors: |
| 966 | - key: app |
| 967 | value: opencontrail-control |
| 968 | topology_key: kubernetes.io/hostname |
| 969 | |
| 970 | nodeAffinity |
| 971 | =============== |
| 972 | |
| 973 | Example pillar: |
| 974 | |
| 975 | .. code-block:: bash |
| 976 | |
| 977 | kubernetes: |
| 978 | control: |
| 979 | service: |
| 980 | memcached: |
| 981 | affinity: |
| 982 | node_affinity: |
| 983 | name: nodeAffinity |
| 984 | expression: |
| 985 | match_expressions: |
| 986 | name: matchExpressions |
| 987 | selectors: |
| 988 | - key: key |
| 989 | operator: In |
| 990 | values: |
| 991 | - value1 |
| 992 | - value2 |
| 993 | |
marco | acdae7e | 2015-12-02 15:35:37 +0100 | [diff] [blame] | 994 | Volumes |
| 995 | ------- |
| 996 | |
| 997 | hostPath |
Jakub Pavlik | 495d06f | 2016-06-17 11:33:05 +0200 | [diff] [blame] | 998 | ========== |
marco | acdae7e | 2015-12-02 15:35:37 +0100 | [diff] [blame] | 999 | |
| 1000 | .. code-block:: yaml |
| 1001 | |
marco | b469f88 | 2016-09-27 09:56:13 +0200 | [diff] [blame] | 1002 | service: |
marco | acdae7e | 2015-12-02 15:35:37 +0100 | [diff] [blame] | 1003 | memcached: |
marco | b469f88 | 2016-09-27 09:56:13 +0200 | [diff] [blame] | 1004 | container: |
| 1005 | memcached: |
| 1006 | volumes: |
| 1007 | - name: volume1 |
| 1008 | mountPath: /volume |
| 1009 | readOnly: True |
marco | acdae7e | 2015-12-02 15:35:37 +0100 | [diff] [blame] | 1010 | ... |
marco | b469f88 | 2016-09-27 09:56:13 +0200 | [diff] [blame] | 1011 | volume: |
| 1012 | volume1: |
| 1013 | name: /etc/certs |
| 1014 | type: hostPath |
| 1015 | path: /etc/certs |
marco | acdae7e | 2015-12-02 15:35:37 +0100 | [diff] [blame] | 1016 | |
| 1017 | emptyDir |
Ales Komarek | 688a04c | 2016-07-15 15:12:30 +0200 | [diff] [blame] | 1018 | ======== |
marco | acdae7e | 2015-12-02 15:35:37 +0100 | [diff] [blame] | 1019 | |
| 1020 | .. code-block:: yaml |
| 1021 | |
marco | b469f88 | 2016-09-27 09:56:13 +0200 | [diff] [blame] | 1022 | service: |
marco | acdae7e | 2015-12-02 15:35:37 +0100 | [diff] [blame] | 1023 | memcached: |
marco | b469f88 | 2016-09-27 09:56:13 +0200 | [diff] [blame] | 1024 | container: |
| 1025 | memcached: |
| 1026 | volumes: |
| 1027 | - name: volume1 |
| 1028 | mountPath: /volume |
| 1029 | readOnly: True |
marco | acdae7e | 2015-12-02 15:35:37 +0100 | [diff] [blame] | 1030 | ... |
marco | b469f88 | 2016-09-27 09:56:13 +0200 | [diff] [blame] | 1031 | volume: |
| 1032 | volume1: |
| 1033 | name: /etc/certs |
| 1034 | type: emptyDir |
| 1035 | |
| 1036 | configMap |
| 1037 | ========= |
| 1038 | |
| 1039 | .. code-block:: yaml |
| 1040 | |
| 1041 | service: |
| 1042 | memcached: |
| 1043 | container: |
| 1044 | memcached: |
| 1045 | volumes: |
| 1046 | - name: volume1 |
| 1047 | mountPath: /volume |
| 1048 | readOnly: True |
| 1049 | ... |
| 1050 | volume: |
| 1051 | volume1: |
| 1052 | type: config_map |
| 1053 | item: |
| 1054 | configMap1: |
| 1055 | key: config.conf |
| 1056 | path: config.conf |
| 1057 | configMap2: |
| 1058 | key: policy.json |
| 1059 | path: policy.json |
Jakub Pavlik | 27ad3a6 | 2016-08-05 11:39:45 +0200 | [diff] [blame] | 1060 | |
marco | 0eda4fb | 2016-10-10 19:08:27 +0200 | [diff] [blame] | 1061 | To mount single configuration file instead of whole directory: |
| 1062 | |
| 1063 | .. code-block:: yaml |
| 1064 | |
| 1065 | service: |
| 1066 | memcached: |
| 1067 | container: |
| 1068 | memcached: |
| 1069 | volumes: |
| 1070 | - name: volume1 |
| 1071 | mountPath: /volume/config.conf |
| 1072 | sub_path: config.conf |
| 1073 | |
marco | fcc20d0 | 2016-10-10 09:56:12 +0200 | [diff] [blame] | 1074 | Generating Jobs |
| 1075 | =============== |
| 1076 | |
| 1077 | Example pillar: |
| 1078 | |
| 1079 | .. code-block:: yaml |
| 1080 | |
| 1081 | kubernetes: |
| 1082 | control: |
| 1083 | job: |
| 1084 | sleep: |
| 1085 | job: sleep |
| 1086 | restart_policy: Never |
| 1087 | container: |
| 1088 | sleep: |
| 1089 | image: busybox |
| 1090 | tag: latest |
| 1091 | command: |
| 1092 | - sleep |
| 1093 | - "3600" |
| 1094 | |
| 1095 | Volumes and Variables can be used as the same way as during Deployment generation. |
| 1096 | |
| 1097 | Custom params: |
| 1098 | |
| 1099 | .. code-block:: yaml |
| 1100 | |
| 1101 | kubernetes: |
| 1102 | control: |
| 1103 | job: |
| 1104 | host_network: True |
| 1105 | host_pid: True |
| 1106 | container: |
| 1107 | sleep: |
| 1108 | privileged: True |
| 1109 | node_selector: |
| 1110 | key: node |
| 1111 | value: one |
| 1112 | image_pull_secretes: password |
| 1113 | |
Filip Pytloun | bdba627 | 2017-10-18 19:44:27 +0200 | [diff] [blame] | 1114 | Role-based access control |
| 1115 | ========================= |
| 1116 | |
| 1117 | To enable RBAC, you need to set following option on your apiserver: |
| 1118 | |
| 1119 | .. code-block:: yaml |
| 1120 | |
| 1121 | kubernetes: |
| 1122 | master: |
| 1123 | auth: |
Andrey Shestakov | f32d707 | 2017-12-27 22:18:51 +0200 | [diff] [blame] | 1124 | mode: Node,RBAC |
Filip Pytloun | bdba627 | 2017-10-18 19:44:27 +0200 | [diff] [blame] | 1125 | |
| 1126 | Then you can use ``kubernetes.control.role`` state to orchestrate role and |
| 1127 | rolebindings. Following example shows how to create brand new role and binding |
| 1128 | for service account: |
| 1129 | |
| 1130 | .. code-block:: yaml |
| 1131 | |
| 1132 | control: |
| 1133 | role: |
| 1134 | etcd-operator: |
| 1135 | kind: ClusterRole |
| 1136 | rules: |
| 1137 | - apiGroups: |
| 1138 | - etcd.coreos.com |
| 1139 | resources: |
| 1140 | - clusters |
| 1141 | verbs: |
| 1142 | - "*" |
| 1143 | - apiGroups: |
| 1144 | - extensions |
| 1145 | resources: |
| 1146 | - thirdpartyresources |
| 1147 | verbs: |
| 1148 | - create |
| 1149 | - apiGroups: |
| 1150 | - storage.k8s.io |
| 1151 | resources: |
| 1152 | - storageclasses |
| 1153 | verbs: |
| 1154 | - create |
| 1155 | - apiGroups: |
| 1156 | - "" |
| 1157 | resources: |
| 1158 | - replicasets |
| 1159 | verbs: |
| 1160 | - "*" |
| 1161 | binding: |
| 1162 | etcd-operator: |
| 1163 | kind: ClusterRoleBinding |
| 1164 | namespace: test # <-- if no namespace, then it's clusterrolebinding |
| 1165 | subject: |
| 1166 | etcd-operator: |
| 1167 | kind: ServiceAccount |
| 1168 | |
| 1169 | Simplest possible use-case, add user test edit permissions on it's test |
| 1170 | namespace: |
| 1171 | |
| 1172 | .. code-block:: yaml |
| 1173 | |
| 1174 | kubernetes: |
| 1175 | control: |
| 1176 | role: |
| 1177 | edit: |
| 1178 | kind: ClusterRole |
| 1179 | # No rules defined, so only binding will be created assuming role |
| 1180 | # already exists |
| 1181 | binding: |
| 1182 | test: |
| 1183 | namespace: test |
| 1184 | subject: |
| 1185 | test: |
| 1186 | kind: User |
Jakub Pavlik | 27ad3a6 | 2016-08-05 11:39:45 +0200 | [diff] [blame] | 1187 | |
Ales Komarek | 9db8af4 | 2017-06-08 11:08:05 +0200 | [diff] [blame] | 1188 | More Information |
| 1189 | ================ |
Jakub Pavlik | 27ad3a6 | 2016-08-05 11:39:45 +0200 | [diff] [blame] | 1190 | |
Ales Komarek | 9db8af4 | 2017-06-08 11:08:05 +0200 | [diff] [blame] | 1191 | * https://github.com/Juniper/kubernetes/blob |
| 1192 | /opencontrail-integration/docs /getting-started-guides/opencontrail.md |
| 1193 | * https://github.com/kubernetes/kubernetes/tree/master/cluster/saltbase |
Jakub Pavlik | 27ad3a6 | 2016-08-05 11:39:45 +0200 | [diff] [blame] | 1194 | |
Filip Pytloun | d06f627 | 2017-02-02 13:02:03 +0100 | [diff] [blame] | 1195 | |
| 1196 | Documentation and Bugs |
| 1197 | ====================== |
| 1198 | |
| 1199 | To learn how to install and update salt-formulas, consult the documentation |
| 1200 | available online at: |
| 1201 | |
| 1202 | http://salt-formulas.readthedocs.io/ |
| 1203 | |
| 1204 | In the unfortunate event that bugs are discovered, they should be reported to |
| 1205 | the appropriate issue tracker. Use Github issue tracker for specific salt |
| 1206 | formula: |
| 1207 | |
| 1208 | https://github.com/salt-formulas/salt-formula-kubernetes/issues |
| 1209 | |
| 1210 | For feature requests, bug reports or blueprints affecting entire ecosystem, |
| 1211 | use Launchpad salt-formulas project: |
| 1212 | |
| 1213 | https://launchpad.net/salt-formulas |
| 1214 | |
| 1215 | You can also join salt-formulas-users team and subscribe to mailing list: |
| 1216 | |
| 1217 | https://launchpad.net/~salt-formulas-users |
| 1218 | |
| 1219 | Developers wishing to work on the salt-formulas projects should always base |
| 1220 | their work on master branch and submit pull request against specific formula. |
| 1221 | |
| 1222 | https://github.com/salt-formulas/salt-formula-kubernetes |
| 1223 | |
| 1224 | Any questions or feedback is always welcome so feel free to join our IRC |
| 1225 | channel: |
| 1226 | |
| 1227 | #salt-formulas @ irc.freenode.net |