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