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