marco | acdae7e | 2015-12-02 15:35:37 +0100 | [diff] [blame] | 1 | |
| 2 | ================== |
| 3 | Kubernetes Formula |
| 4 | ================== |
| 5 | |
Jakub Pavlik | 495d06f | 2016-06-17 11:33:05 +0200 | [diff] [blame] | 6 | Kubernetes is an open-source system for automating deployment, scaling, and management of containerized applications. |
| 7 | |
| 8 | This formula deploys production ready Kubernetes and generate Kubernetes manifests as well. |
marco | acdae7e | 2015-12-02 15:35:37 +0100 | [diff] [blame] | 9 | |
| 10 | Based on official Kubernetes salt |
| 11 | https://github.com/kubernetes/kubernetes/tree/master/cluster/saltbase |
| 12 | |
| 13 | Extended on Contrail contribution https://github.com/Juniper/kubernetes/blob/opencontrail-integration/docs/getting-started-guides/opencontrail.md |
| 14 | |
| 15 | |
| 16 | Sample pillars |
| 17 | ============== |
| 18 | |
Tomáš Kukrál | 189da4b | 2017-01-18 14:30:09 +0100 | [diff] [blame] | 19 | **REQUIRED:** Define image to use for hyperkube, CNIs and calicoctl image |
| 20 | |
| 21 | .. code-block:: yaml |
| 22 | |
| 23 | parameters: |
| 24 | kubernetes: |
| 25 | common: |
| 26 | hyperkube: |
Tomáš Kukrál | a636f0e | 2017-03-21 11:09:55 +0100 | [diff] [blame] | 27 | image: gcr.io/google_containers/hyperkube:v1.5.2 |
Tomáš Kukrál | 189da4b | 2017-01-18 14:30:09 +0100 | [diff] [blame] | 28 | pool: |
| 29 | network: |
| 30 | calicoctl: |
| 31 | image: calico/ctl |
| 32 | cni: |
| 33 | image: calico/cni |
| 34 | |
Tomáš Kukrál | 25a64d7 | 2017-03-23 14:14:07 +0100 | [diff] [blame] | 35 | Enable helm-tiller addon |
Tomáš Kukrál | 1b50f77 | 2017-03-23 12:51:32 +0100 | [diff] [blame] | 36 | |
| 37 | .. code-block:: yaml |
| 38 | |
| 39 | parameters: |
| 40 | kubernetes: |
| 41 | master: |
| 42 | addons: |
| 43 | helm: |
| 44 | enabled: true |
| 45 | |
Tomáš Kukrál | 25a64d7 | 2017-03-23 14:14:07 +0100 | [diff] [blame] | 46 | Enable netchecker addon |
| 47 | |
| 48 | .. code-block:: yaml |
| 49 | |
| 50 | parameters: |
| 51 | kubernetes: |
| 52 | master: |
| 53 | namespace: |
| 54 | netchecker: |
| 55 | enabled: true |
| 56 | addons: |
| 57 | netchecker: |
| 58 | enabled: true |
Tomáš Kukrál | 1b50f77 | 2017-03-23 12:51:32 +0100 | [diff] [blame] | 59 | |
Tomáš Kukrál | aff3526 | 2017-04-18 12:37:45 +0200 | [diff] [blame^] | 60 | Enable autoscaler for dns addon. Poll period can be skipped. |
| 61 | |
| 62 | .. code-block:: yaml |
| 63 | |
| 64 | kubernetes: |
| 65 | master: |
| 66 | addons: |
| 67 | dns: |
| 68 | domain: cluster.local |
| 69 | enabled: true |
| 70 | replicas: 1 |
| 71 | server: 10.254.0.10 |
| 72 | autoscaler: |
| 73 | enabled: true |
| 74 | poll-period-seconds: 60 |
| 75 | |
| 76 | |
Tomáš Kukrál | 6ef3f89 | 2017-02-15 12:02:22 +0100 | [diff] [blame] | 77 | Pass aditional parameters to daemons: |
| 78 | |
| 79 | .. code-block:: yaml |
| 80 | |
| 81 | parameters: |
| 82 | kubernetes: |
| 83 | master: |
| 84 | apiserver: |
| 85 | daemon_opts: |
| 86 | storage-backend: pigeon |
| 87 | controller_manager: |
| 88 | daemon_opts: |
| 89 | log-dir: /dev/nulL |
| 90 | pool: |
| 91 | kubelet: |
| 92 | daemon_opts: |
| 93 | max-pods: "6" |
| 94 | |
Tomáš Kukrál | 189da4b | 2017-01-18 14:30:09 +0100 | [diff] [blame] | 95 | |
Ales Komarek | 688a04c | 2016-07-15 15:12:30 +0200 | [diff] [blame] | 96 | Containers on pool definitions in pool.service.local |
| 97 | |
Jakub Pavlik | 7e98532 | 2016-07-17 13:16:15 +0200 | [diff] [blame] | 98 | .. code-block:: yaml |
| 99 | |
| 100 | parameters: |
| 101 | kubernetes: |
| 102 | pool: |
| 103 | service: |
| 104 | local: |
| 105 | enabled: False |
| 106 | service: libvirt |
| 107 | cluster: openstack-compute |
| 108 | namespace: default |
| 109 | role: ${linux:system:name} |
| 110 | type: LoadBalancer |
| 111 | kind: Deployment |
| 112 | apiVersion: extensions/v1beta1 |
| 113 | replicas: 1 |
| 114 | host_pid: True |
| 115 | nodeSelector: |
| 116 | - key: openstack |
| 117 | value: ${linux:system:name} |
| 118 | hostNetwork: True |
| 119 | container: |
| 120 | libvirt-compute: |
| 121 | privileged: True |
| 122 | image: ${_param:docker_repository}/libvirt-compute |
| 123 | tag: ${_param:openstack_container_tag} |
Ales Komarek | 688a04c | 2016-07-15 15:12:30 +0200 | [diff] [blame] | 124 | |
| 125 | Master definition |
| 126 | |
marco | acdae7e | 2015-12-02 15:35:37 +0100 | [diff] [blame] | 127 | .. code-block:: yaml |
| 128 | |
| 129 | kubernetes: |
Jakub Pavlik | 495d06f | 2016-06-17 11:33:05 +0200 | [diff] [blame] | 130 | master: |
| 131 | addons: |
| 132 | dns: |
| 133 | domain: cluster.local |
| 134 | enabled: true |
| 135 | replicas: 1 |
| 136 | server: 10.254.0.10 |
Jakub Pavlik | 495d06f | 2016-06-17 11:33:05 +0200 | [diff] [blame] | 137 | admin: |
| 138 | password: password |
| 139 | username: admin |
| 140 | apiserver: |
| 141 | address: 10.0.175.100 |
Swann Croiset | ff97efc | 2017-02-23 13:32:33 +0100 | [diff] [blame] | 142 | secure_port: 443 |
| 143 | insecure_address: 127.0.0.1 |
| 144 | insecure_port: 8080 |
Jakub Pavlik | 495d06f | 2016-06-17 11:33:05 +0200 | [diff] [blame] | 145 | ca: kubernetes |
| 146 | enabled: true |
| 147 | etcd: |
| 148 | host: 127.0.0.1 |
| 149 | members: |
| 150 | - host: 10.0.175.100 |
| 151 | name: node040 |
| 152 | name: node040 |
| 153 | token: ca939ec9c2a17b0786f6d411fe019e9b |
| 154 | kubelet: |
| 155 | allow_privileged: true |
| 156 | network: |
| 157 | engine: calico |
| 158 | hash: fb5e30ebe6154911a66ec3fb5f1195b2 |
| 159 | private_ip_range: 10.150.0.0/16 |
| 160 | version: v0.19.0 |
| 161 | service_addresses: 10.254.0.0/16 |
| 162 | storage: |
| 163 | engine: glusterfs |
| 164 | members: |
| 165 | - host: 10.0.175.101 |
| 166 | port: 24007 |
| 167 | - host: 10.0.175.102 |
| 168 | port: 24007 |
| 169 | - host: 10.0.175.103 |
| 170 | port: 24007 |
| 171 | port: 24007 |
| 172 | token: |
| 173 | admin: DFvQ8GJ9JD4fKNfuyEddw3rjnFTkUKsv |
| 174 | controller_manager: EreGh6AnWf8DxH8cYavB2zS029PUi7vx |
| 175 | dns: RAFeVSE4UvsCz4gk3KYReuOI5jsZ1Xt3 |
| 176 | kube_proxy: DFvQ8GelB7afH3wClC9romaMPhquyyEe |
| 177 | kubelet: 7bN5hJ9JD4fKjnFTkUKsvVNfuyEddw3r |
| 178 | logging: MJkXKdbgqRmTHSa2ykTaOaMykgO6KcEf |
| 179 | monitoring: hnsj0XqABgrSww7Nqo7UVTSZLJUt2XRd |
| 180 | scheduler: HY1UUxEPpmjW4a1dDLGIANYQp1nZkLDk |
| 181 | version: v1.2.4 |
| 182 | |
marco | acdae7e | 2015-12-02 15:35:37 +0100 | [diff] [blame] | 183 | |
| 184 | kubernetes: |
Jakub Pavlik | 495d06f | 2016-06-17 11:33:05 +0200 | [diff] [blame] | 185 | pool: |
| 186 | address: 0.0.0.0 |
| 187 | allow_privileged: true |
| 188 | ca: kubernetes |
| 189 | cluster_dns: 10.254.0.10 |
| 190 | cluster_domain: cluster.local |
| 191 | enabled: true |
| 192 | kubelet: |
| 193 | allow_privileged: true |
| 194 | config: /etc/kubernetes/manifests |
| 195 | frequency: 5s |
| 196 | master: |
| 197 | apiserver: |
| 198 | members: |
| 199 | - host: 10.0.175.100 |
| 200 | etcd: |
| 201 | members: |
| 202 | - host: 10.0.175.100 |
| 203 | host: 10.0.175.100 |
| 204 | network: |
| 205 | engine: calico |
| 206 | hash: fb5e30ebe6154911a66ec3fb5f1195b2 |
| 207 | version: v0.19.0 |
| 208 | token: |
| 209 | kube_proxy: DFvQ8GelB7afH3wClC9romaMPhquyyEe |
| 210 | kubelet: 7bN5hJ9JD4fKjnFTkUKsvVNfuyEddw3r |
| 211 | version: v1.2.4 |
marco | acdae7e | 2015-12-02 15:35:37 +0100 | [diff] [blame] | 212 | |
Jakub Pavlik | 495d06f | 2016-06-17 11:33:05 +0200 | [diff] [blame] | 213 | Kubernetes with OpenContrail network plugin |
| 214 | ------------------------------------------------ |
marco | acdae7e | 2015-12-02 15:35:37 +0100 | [diff] [blame] | 215 | |
| 216 | On Master: |
| 217 | |
| 218 | .. code-block:: yaml |
| 219 | |
| 220 | kubernetes: |
| 221 | master: |
| 222 | network: |
| 223 | engine: opencontrail |
| 224 | host: 10.0.170.70 |
| 225 | port: 8082 |
| 226 | default_domain: default-domain |
| 227 | default_project: default-domain:default-project |
| 228 | public_network: default-domain:default-project:Public |
| 229 | public_ip_range: 185.22.97.128/26 |
| 230 | private_ip_range: 10.150.0.0/16 |
| 231 | service_cluster_ip_range: 10.254.0.0/16 |
| 232 | network_label: name |
| 233 | service_label: uses |
| 234 | cluster_service: kube-system/default |
| 235 | network_manager: |
| 236 | image: pupapaik/opencontrail-kube-network-manager |
| 237 | tag: release-1.1-jpa-final-1 |
| 238 | |
| 239 | On pools: |
| 240 | |
| 241 | .. code-block:: yaml |
| 242 | |
| 243 | kubernetes: |
| 244 | pool: |
| 245 | network: |
| 246 | engine: opencontrail |
| 247 | |
Jakub Pavlik | 1cfc1fe | 2016-07-25 11:01:52 +0200 | [diff] [blame] | 248 | Kubernetes control plane running in systemd |
| 249 | ------------------------------------------- |
| 250 | |
| 251 | 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. |
| 252 | |
| 253 | .. code-block:: yaml |
| 254 | |
| 255 | kubernetes: |
| 256 | master: |
| 257 | container: false |
| 258 | |
| 259 | kubernetes: |
| 260 | pool: |
| 261 | container: false |
| 262 | |
marco | 055ff85 | 2016-07-27 15:22:33 +0200 | [diff] [blame] | 263 | Because k8s services run under kube user without root privileges, there is need to change secure port for apiserver. |
| 264 | |
| 265 | .. code-block:: yaml |
| 266 | |
| 267 | kubernetes: |
| 268 | master: |
| 269 | apiserver: |
| 270 | secure_port: 8081 |
| 271 | |
marco | acdae7e | 2015-12-02 15:35:37 +0100 | [diff] [blame] | 272 | Kubernetes with Flannel |
| 273 | ----------------------- |
| 274 | |
| 275 | On Master: |
| 276 | |
| 277 | .. code-block:: yaml |
| 278 | |
| 279 | kubernetes: |
| 280 | master: |
| 281 | network: |
| 282 | engine: flannel |
Jakub Pavlik | 7e98532 | 2016-07-17 13:16:15 +0200 | [diff] [blame] | 283 | # If you don't register master as node: |
marco | a05621f | 2016-07-14 10:35:24 +0200 | [diff] [blame] | 284 | etcd: |
| 285 | members: |
| 286 | - host: 10.0.175.101 |
| 287 | port: 4001 |
| 288 | - host: 10.0.175.102 |
| 289 | port: 4001 |
| 290 | - host: 10.0.175.103 |
| 291 | port: 4001 |
marco | acdae7e | 2015-12-02 15:35:37 +0100 | [diff] [blame] | 292 | common: |
| 293 | network: |
| 294 | engine: flannel |
| 295 | |
| 296 | On pools: |
| 297 | |
| 298 | .. code-block:: yaml |
| 299 | |
| 300 | kubernetes: |
| 301 | pool: |
| 302 | network: |
| 303 | engine: flannel |
marco | a05621f | 2016-07-14 10:35:24 +0200 | [diff] [blame] | 304 | etcd: |
| 305 | members: |
| 306 | - host: 10.0.175.101 |
| 307 | port: 4001 |
| 308 | - host: 10.0.175.102 |
| 309 | port: 4001 |
| 310 | - host: 10.0.175.103 |
| 311 | port: 4001 |
marco | acdae7e | 2015-12-02 15:35:37 +0100 | [diff] [blame] | 312 | common: |
| 313 | network: |
| 314 | engine: flannel |
| 315 | |
| 316 | Kubernetes with Calico |
| 317 | ----------------------- |
| 318 | |
| 319 | On Master: |
| 320 | |
| 321 | .. code-block:: yaml |
| 322 | |
| 323 | kubernetes: |
| 324 | master: |
| 325 | network: |
| 326 | engine: calico |
Jakub Pavlik | 7e98532 | 2016-07-17 13:16:15 +0200 | [diff] [blame] | 327 | # If you don't register master as node: |
marco | a05621f | 2016-07-14 10:35:24 +0200 | [diff] [blame] | 328 | etcd: |
| 329 | members: |
| 330 | - host: 10.0.175.101 |
| 331 | port: 4001 |
| 332 | - host: 10.0.175.102 |
| 333 | port: 4001 |
| 334 | - host: 10.0.175.103 |
| 335 | port: 4001 |
marco | acdae7e | 2015-12-02 15:35:37 +0100 | [diff] [blame] | 336 | |
| 337 | On pools: |
| 338 | |
| 339 | .. code-block:: yaml |
| 340 | |
| 341 | kubernetes: |
| 342 | pool: |
| 343 | network: |
| 344 | engine: calico |
marco | a05621f | 2016-07-14 10:35:24 +0200 | [diff] [blame] | 345 | etcd: |
| 346 | members: |
| 347 | - host: 10.0.175.101 |
| 348 | port: 4001 |
| 349 | - host: 10.0.175.102 |
| 350 | port: 4001 |
| 351 | - host: 10.0.175.103 |
| 352 | port: 4001 |
marco | acdae7e | 2015-12-02 15:35:37 +0100 | [diff] [blame] | 353 | |
Tomáš Kukrál | 34c5936 | 2017-03-01 14:00:37 +0100 | [diff] [blame] | 354 | Running with secured etcd: |
| 355 | |
| 356 | .. code-block:: yaml |
| 357 | |
| 358 | kubernetes: |
| 359 | pool: |
| 360 | network: |
| 361 | engine: calico |
| 362 | etcd: |
| 363 | ssl: |
| 364 | enabled: true |
| 365 | master: |
| 366 | network: |
| 367 | engine: calico |
| 368 | etcd: |
| 369 | ssl: |
| 370 | enabled: true |
| 371 | |
Tomáš Kukrál | 7e91a94 | 2017-03-23 16:02:52 +0100 | [diff] [blame] | 372 | Enable Prometheus metrics in Felix |
| 373 | |
| 374 | .. code-block:: yaml |
| 375 | |
| 376 | kubernetes: |
| 377 | pool: |
| 378 | network: |
| 379 | prometheus: |
| 380 | enabled: true |
| 381 | master: |
| 382 | network: |
| 383 | prometheus: |
| 384 | enabled: true |
| 385 | |
Jakub Pavlik | 7e98532 | 2016-07-17 13:16:15 +0200 | [diff] [blame] | 386 | Post deployment configuration |
| 387 | |
| 388 | .. code-block:: bash |
Jakub Pavlik | 232833c | 2016-07-17 13:21:00 +0200 | [diff] [blame] | 389 | |
Jakub Pavlik | 7e98532 | 2016-07-17 13:16:15 +0200 | [diff] [blame] | 390 | # set ETCD |
| 391 | export ETCD_AUTHORITY=10.0.111.201:4001 |
| 392 | |
| 393 | # Set NAT for pods subnet |
| 394 | calicoctl pool add 192.168.0.0/16 --nat-outgoing |
| 395 | |
| 396 | # Status commands |
| 397 | calicoctl status |
| 398 | calicoctl node show |
| 399 | |
Jakub Pavlik | 495d06f | 2016-06-17 11:33:05 +0200 | [diff] [blame] | 400 | Kubernetes with GlusterFS for storage |
| 401 | --------------------------------------------- |
| 402 | |
| 403 | .. code-block:: yaml |
| 404 | |
| 405 | kubernetes: |
Tomáš Kukrál | 4f0dae3 | 2017-03-21 19:04:19 +0100 | [diff] [blame] | 406 | master: |
Jakub Pavlik | 495d06f | 2016-06-17 11:33:05 +0200 | [diff] [blame] | 407 | ... |
| 408 | storage: |
| 409 | engine: glusterfs |
| 410 | port: 24007 |
| 411 | members: |
| 412 | - host: 10.0.175.101 |
| 413 | port: 24007 |
| 414 | - host: 10.0.175.102 |
| 415 | port: 24007 |
| 416 | - host: 10.0.175.103 |
| 417 | port: 24007 |
| 418 | ... |
| 419 | |
marco | 45fc1b7 | 2016-07-02 16:11:18 +0200 | [diff] [blame] | 420 | Kubernetes namespaces |
| 421 | --------------------- |
| 422 | |
| 423 | Create namespace: |
| 424 | |
| 425 | .. code-block:: yaml |
| 426 | |
| 427 | kubernetes: |
Tomáš Kukrál | 4f0dae3 | 2017-03-21 19:04:19 +0100 | [diff] [blame] | 428 | master: |
marco | 45fc1b7 | 2016-07-02 16:11:18 +0200 | [diff] [blame] | 429 | ... |
| 430 | namespace: |
| 431 | kube-system: |
| 432 | enabled: True |
| 433 | namespace2: |
| 434 | enabled: True |
| 435 | namespace3: |
| 436 | enabled: False |
| 437 | ... |
| 438 | |
| 439 | Kubernetes labels |
| 440 | ----------------- |
| 441 | |
Marek Celoud | 901020b | 2017-01-27 14:51:41 +0100 | [diff] [blame] | 442 | Label node: |
marco | 45fc1b7 | 2016-07-02 16:11:18 +0200 | [diff] [blame] | 443 | |
| 444 | .. code-block:: yaml |
| 445 | |
Marek Celoud | 901020b | 2017-01-27 14:51:41 +0100 | [diff] [blame] | 446 | kubernetes: |
| 447 | master: |
| 448 | label: |
| 449 | label01: |
| 450 | value: value01 |
| 451 | node: node01 |
| 452 | enabled: true |
| 453 | key: key01 |
marco | 45fc1b7 | 2016-07-02 16:11:18 +0200 | [diff] [blame] | 454 | ... |
marco | 45fc1b7 | 2016-07-02 16:11:18 +0200 | [diff] [blame] | 455 | |
marco | f7efecb | 2016-07-16 16:13:37 +0200 | [diff] [blame] | 456 | Pull images from private registries |
| 457 | ----------------------------------- |
| 458 | |
| 459 | .. code-block:: yaml |
| 460 | |
| 461 | kubernetes: |
Tomáš Kukrál | 4f0dae3 | 2017-03-21 19:04:19 +0100 | [diff] [blame] | 462 | master: |
marco | f7efecb | 2016-07-16 16:13:37 +0200 | [diff] [blame] | 463 | ... |
| 464 | registry: |
| 465 | secret: |
| 466 | registry01: |
| 467 | enabled: True |
| 468 | key: (get from `cat /root/.docker/config.json | base64`) |
| 469 | namespace: default |
| 470 | ... |
| 471 | control: |
| 472 | ... |
| 473 | service: |
| 474 | service01: |
| 475 | ... |
| 476 | image_pull_secretes: registry01 |
| 477 | ... |
| 478 | |
Jakub Pavlik | 495d06f | 2016-06-17 11:33:05 +0200 | [diff] [blame] | 479 | Kubernetes Service Definitions in pillars |
| 480 | ========================================== |
| 481 | |
| 482 | Following samples show how to generate kubernetes manifest as well and provide single tool for complete infrastructure management. |
| 483 | |
| 484 | Deployment manifest |
| 485 | --------------------- |
marco | acdae7e | 2015-12-02 15:35:37 +0100 | [diff] [blame] | 486 | |
| 487 | .. code-block:: yaml |
| 488 | |
| 489 | salt: |
| 490 | control: |
| 491 | enabled: True |
| 492 | hostNetwork: True |
| 493 | service: |
| 494 | memcached: |
| 495 | privileged: True |
| 496 | service: memcached |
| 497 | role: server |
| 498 | type: LoadBalancer |
| 499 | replicas: 3 |
| 500 | kind: Deployment |
| 501 | apiVersion: extensions/v1beta1 |
| 502 | ports: |
| 503 | - port: 8774 |
| 504 | name: nova-api |
| 505 | - port: 8775 |
| 506 | name: nova-metadata |
| 507 | volume: |
| 508 | volume_name: |
| 509 | type: hostPath |
| 510 | mount: /certs |
| 511 | path: /etc/certs |
| 512 | container: |
| 513 | memcached: |
| 514 | image: memcached |
| 515 | tag:2 |
| 516 | ports: |
| 517 | - port: 8774 |
| 518 | name: nova-api |
| 519 | - port: 8775 |
| 520 | name: nova-metadata |
| 521 | variables: |
| 522 | - name: HTTP_TLS_CERTIFICATE: |
| 523 | value: /certs/domain.crt |
| 524 | - name: HTTP_TLS_KEY |
| 525 | value: /certs/domain.key |
| 526 | volumes: |
| 527 | - name: /etc/certs |
| 528 | type: hostPath |
| 529 | mount: /certs |
| 530 | path: /etc/certs |
| 531 | |
marco | be30c8d | 2016-10-11 19:16:35 +0200 | [diff] [blame] | 532 | PetSet manifest |
| 533 | --------------------- |
| 534 | |
| 535 | .. code-block:: yaml |
| 536 | |
| 537 | service: |
| 538 | memcached: |
| 539 | apiVersion: apps/v1alpha1 |
| 540 | kind: PetSet |
| 541 | service_name: 'memcached' |
| 542 | container: |
| 543 | memcached: |
| 544 | ... |
| 545 | |
| 546 | |
Filip Pytloun | 9a4a40f | 2016-09-22 16:28:19 +0200 | [diff] [blame] | 547 | Configmap |
| 548 | --------- |
| 549 | |
| 550 | You are able to create configmaps using support layer between formulas. |
| 551 | It works simple, eg. in nova formula there's file ``meta/config.yml`` which |
| 552 | defines config files used by that service and roles. |
| 553 | |
| 554 | Kubernetes formula is able to generate these files using custom pillar and |
| 555 | grains structure. This way you are able to run docker images built by any way |
| 556 | while still re-using your configuration management. |
| 557 | |
| 558 | Example pillar: |
| 559 | |
| 560 | .. code-block:: bash |
| 561 | |
| 562 | kubernetes: |
| 563 | control: |
Jakub Pavlik | a277972 | 2016-11-25 15:35:26 +0100 | [diff] [blame] | 564 | config_type: default|kubernetes # Output is yaml k8s or default single files |
Filip Pytloun | 9a4a40f | 2016-09-22 16:28:19 +0200 | [diff] [blame] | 565 | configmap: |
| 566 | nova-control: |
| 567 | grains: |
| 568 | # Alternate grains as OS running in container may differ from |
| 569 | # salt minion OS. Needed only if grains matters for config |
| 570 | # generation. |
| 571 | os_family: Debian |
| 572 | pillar: |
| 573 | # Generic pillar for nova controller |
| 574 | nova: |
| 575 | controller: |
| 576 | enabled: true |
| 577 | versionn: liberty |
| 578 | ... |
| 579 | |
| 580 | To tell which services supports config generation, you need to ensure pillar |
| 581 | structure like this to determine support: |
| 582 | |
| 583 | .. code-block:: yaml |
| 584 | |
| 585 | nova: |
| 586 | _support: |
| 587 | config: |
| 588 | enabled: true |
| 589 | |
marco | d4d3dbd | 2016-09-27 11:36:40 +0200 | [diff] [blame] | 590 | initContainers |
| 591 | -------------- |
| 592 | |
| 593 | Example pillar: |
| 594 | |
| 595 | .. code-block:: bash |
| 596 | |
| 597 | kubernetes: |
| 598 | control: |
| 599 | service: |
| 600 | memcached: |
| 601 | init_containers: |
| 602 | - name: test-mysql |
| 603 | image: busybox |
| 604 | command: |
| 605 | - sleep |
| 606 | - 3600 |
| 607 | volumes: |
| 608 | - name: config |
| 609 | mount: /test |
| 610 | - name: test-memcached |
| 611 | image: busybox |
| 612 | command: |
| 613 | - sleep |
| 614 | - 3600 |
| 615 | volumes: |
| 616 | - name: config |
| 617 | mount: /test |
| 618 | |
marco | ee859d3 | 2016-11-07 11:04:57 +0100 | [diff] [blame] | 619 | Affinity |
| 620 | -------- |
| 621 | |
| 622 | podAffinity |
| 623 | =========== |
| 624 | |
| 625 | Example pillar: |
| 626 | |
| 627 | .. code-block:: bash |
| 628 | |
| 629 | kubernetes: |
| 630 | control: |
| 631 | service: |
| 632 | memcached: |
| 633 | affinity: |
| 634 | pod_affinity: |
| 635 | name: podAffinity |
| 636 | expression: |
| 637 | label_selector: |
| 638 | name: labelSelector |
| 639 | selectors: |
| 640 | - key: app |
| 641 | value: memcached |
| 642 | topology_key: kubernetes.io/hostname |
| 643 | |
| 644 | podAntiAffinity |
| 645 | =============== |
| 646 | |
| 647 | Example pillar: |
| 648 | |
| 649 | .. code-block:: bash |
| 650 | |
| 651 | kubernetes: |
| 652 | control: |
| 653 | service: |
| 654 | memcached: |
| 655 | affinity: |
| 656 | anti_affinity: |
| 657 | name: podAntiAffinity |
| 658 | expression: |
| 659 | label_selector: |
| 660 | name: labelSelector |
| 661 | selectors: |
| 662 | - key: app |
| 663 | value: opencontrail-control |
| 664 | topology_key: kubernetes.io/hostname |
| 665 | |
| 666 | nodeAffinity |
| 667 | =============== |
| 668 | |
| 669 | Example pillar: |
| 670 | |
| 671 | .. code-block:: bash |
| 672 | |
| 673 | kubernetes: |
| 674 | control: |
| 675 | service: |
| 676 | memcached: |
| 677 | affinity: |
| 678 | node_affinity: |
| 679 | name: nodeAffinity |
| 680 | expression: |
| 681 | match_expressions: |
| 682 | name: matchExpressions |
| 683 | selectors: |
| 684 | - key: key |
| 685 | operator: In |
| 686 | values: |
| 687 | - value1 |
| 688 | - value2 |
| 689 | |
marco | acdae7e | 2015-12-02 15:35:37 +0100 | [diff] [blame] | 690 | Volumes |
| 691 | ------- |
| 692 | |
| 693 | hostPath |
Jakub Pavlik | 495d06f | 2016-06-17 11:33:05 +0200 | [diff] [blame] | 694 | ========== |
marco | acdae7e | 2015-12-02 15:35:37 +0100 | [diff] [blame] | 695 | |
| 696 | .. code-block:: yaml |
| 697 | |
marco | b469f88 | 2016-09-27 09:56:13 +0200 | [diff] [blame] | 698 | service: |
marco | acdae7e | 2015-12-02 15:35:37 +0100 | [diff] [blame] | 699 | memcached: |
marco | b469f88 | 2016-09-27 09:56:13 +0200 | [diff] [blame] | 700 | container: |
| 701 | memcached: |
| 702 | volumes: |
| 703 | - name: volume1 |
| 704 | mountPath: /volume |
| 705 | readOnly: True |
marco | acdae7e | 2015-12-02 15:35:37 +0100 | [diff] [blame] | 706 | ... |
marco | b469f88 | 2016-09-27 09:56:13 +0200 | [diff] [blame] | 707 | volume: |
| 708 | volume1: |
| 709 | name: /etc/certs |
| 710 | type: hostPath |
| 711 | path: /etc/certs |
marco | acdae7e | 2015-12-02 15:35:37 +0100 | [diff] [blame] | 712 | |
| 713 | emptyDir |
Ales Komarek | 688a04c | 2016-07-15 15:12:30 +0200 | [diff] [blame] | 714 | ======== |
marco | acdae7e | 2015-12-02 15:35:37 +0100 | [diff] [blame] | 715 | |
| 716 | .. code-block:: yaml |
| 717 | |
marco | b469f88 | 2016-09-27 09:56:13 +0200 | [diff] [blame] | 718 | service: |
marco | acdae7e | 2015-12-02 15:35:37 +0100 | [diff] [blame] | 719 | memcached: |
marco | b469f88 | 2016-09-27 09:56:13 +0200 | [diff] [blame] | 720 | container: |
| 721 | memcached: |
| 722 | volumes: |
| 723 | - name: volume1 |
| 724 | mountPath: /volume |
| 725 | readOnly: True |
marco | acdae7e | 2015-12-02 15:35:37 +0100 | [diff] [blame] | 726 | ... |
marco | b469f88 | 2016-09-27 09:56:13 +0200 | [diff] [blame] | 727 | volume: |
| 728 | volume1: |
| 729 | name: /etc/certs |
| 730 | type: emptyDir |
| 731 | |
| 732 | configMap |
| 733 | ========= |
| 734 | |
| 735 | .. code-block:: yaml |
| 736 | |
| 737 | service: |
| 738 | memcached: |
| 739 | container: |
| 740 | memcached: |
| 741 | volumes: |
| 742 | - name: volume1 |
| 743 | mountPath: /volume |
| 744 | readOnly: True |
| 745 | ... |
| 746 | volume: |
| 747 | volume1: |
| 748 | type: config_map |
| 749 | item: |
| 750 | configMap1: |
| 751 | key: config.conf |
| 752 | path: config.conf |
| 753 | configMap2: |
| 754 | key: policy.json |
| 755 | path: policy.json |
Jakub Pavlik | 27ad3a6 | 2016-08-05 11:39:45 +0200 | [diff] [blame] | 756 | |
marco | 0eda4fb | 2016-10-10 19:08:27 +0200 | [diff] [blame] | 757 | To mount single configuration file instead of whole directory: |
| 758 | |
| 759 | .. code-block:: yaml |
| 760 | |
| 761 | service: |
| 762 | memcached: |
| 763 | container: |
| 764 | memcached: |
| 765 | volumes: |
| 766 | - name: volume1 |
| 767 | mountPath: /volume/config.conf |
| 768 | sub_path: config.conf |
| 769 | |
marco | fcc20d0 | 2016-10-10 09:56:12 +0200 | [diff] [blame] | 770 | Generating Jobs |
| 771 | =============== |
| 772 | |
| 773 | Example pillar: |
| 774 | |
| 775 | .. code-block:: yaml |
| 776 | |
| 777 | kubernetes: |
| 778 | control: |
| 779 | job: |
| 780 | sleep: |
| 781 | job: sleep |
| 782 | restart_policy: Never |
| 783 | container: |
| 784 | sleep: |
| 785 | image: busybox |
| 786 | tag: latest |
| 787 | command: |
| 788 | - sleep |
| 789 | - "3600" |
| 790 | |
| 791 | Volumes and Variables can be used as the same way as during Deployment generation. |
| 792 | |
| 793 | Custom params: |
| 794 | |
| 795 | .. code-block:: yaml |
| 796 | |
| 797 | kubernetes: |
| 798 | control: |
| 799 | job: |
| 800 | host_network: True |
| 801 | host_pid: True |
| 802 | container: |
| 803 | sleep: |
| 804 | privileged: True |
| 805 | node_selector: |
| 806 | key: node |
| 807 | value: one |
| 808 | image_pull_secretes: password |
| 809 | |
Jakub Pavlik | 27ad3a6 | 2016-08-05 11:39:45 +0200 | [diff] [blame] | 810 | Documentation and Bugs |
Filip Pytloun | 06a5540 | 2016-08-12 14:53:30 +0200 | [diff] [blame] | 811 | ====================== |
Jakub Pavlik | 27ad3a6 | 2016-08-05 11:39:45 +0200 | [diff] [blame] | 812 | |
| 813 | To learn how to deploy OpenStack Salt, consult the documentation available |
| 814 | online at: |
| 815 | |
| 816 | https://wiki.openstack.org/wiki/OpenStackSalt |
| 817 | |
| 818 | In the unfortunate event that bugs are discovered, they should be reported to |
| 819 | the appropriate bug tracker. If you obtained the software from a 3rd party |
| 820 | operating system vendor, it is often wise to use their own bug tracker for |
| 821 | reporting problems. In all other cases use the master OpenStack bug tracker, |
| 822 | available at: |
| 823 | |
| 824 | http://bugs.launchpad.net/openstack-salt |
| 825 | |
| 826 | Developers wishing to work on the OpenStack Salt project should always base |
| 827 | their work on the latest formulas code, available from the master GIT |
| 828 | repository at: |
| 829 | |
| 830 | https://git.openstack.org/cgit/openstack/salt-formula-kubernetes |
| 831 | |
| 832 | Developers should also join the discussion on the IRC list, at: |
| 833 | |
| 834 | https://wiki.openstack.org/wiki/Meetings/openstack-salt |
Filip Pytloun | 06a5540 | 2016-08-12 14:53:30 +0200 | [diff] [blame] | 835 | |
| 836 | Copyright and authors |
| 837 | ===================== |
| 838 | |
| 839 | (c) 2016 tcp cloud a.s. |
| 840 | (c) 2016 OpenStack Foundation |
Filip Pytloun | d06f627 | 2017-02-02 13:02:03 +0100 | [diff] [blame] | 841 | |
| 842 | Documentation and Bugs |
| 843 | ====================== |
| 844 | |
| 845 | To learn how to install and update salt-formulas, consult the documentation |
| 846 | available online at: |
| 847 | |
| 848 | http://salt-formulas.readthedocs.io/ |
| 849 | |
| 850 | In the unfortunate event that bugs are discovered, they should be reported to |
| 851 | the appropriate issue tracker. Use Github issue tracker for specific salt |
| 852 | formula: |
| 853 | |
| 854 | https://github.com/salt-formulas/salt-formula-kubernetes/issues |
| 855 | |
| 856 | For feature requests, bug reports or blueprints affecting entire ecosystem, |
| 857 | use Launchpad salt-formulas project: |
| 858 | |
| 859 | https://launchpad.net/salt-formulas |
| 860 | |
| 861 | You can also join salt-formulas-users team and subscribe to mailing list: |
| 862 | |
| 863 | https://launchpad.net/~salt-formulas-users |
| 864 | |
| 865 | Developers wishing to work on the salt-formulas projects should always base |
| 866 | their work on master branch and submit pull request against specific formula. |
| 867 | |
| 868 | https://github.com/salt-formulas/salt-formula-kubernetes |
| 869 | |
| 870 | Any questions or feedback is always welcome so feel free to join our IRC |
| 871 | channel: |
| 872 | |
| 873 | #salt-formulas @ irc.freenode.net |