示例

DC/OS Enterprise 的常见示例配置

此页面提供多种常见示例配置。除非另有明确指示,配置参数同时适用于 DC/OS 开源DC/OS Enterprise。这些评论在本示例 config.yaml 用于指示 DC/OS 产品类型。

  • # DC/OS Open Source only - 仅适用于 DC/OS。Open Source
  • # DC/OS Enterprise only - 仅适用于 DC/OS Enterprise。Enterprise

所有参数

此样本 config.yaml 文件包括 DC/OS 的所有可用配置参数。

  1. agent_list:
  2. - <agent-private-ip-1>
  3. - <agent-private-ip-2>
  4. - <agent-private-ip-3>
  5. # DC/OS Enterprise only
  6. auth_cookie_secure_flag: `<true|false>`
  7. bootstrap_url: <path-to-installer>
  8. # DC/OS Enterprise only
  9. bouncer_expiration_auth_token_days: `<time>`
  10. cluster_docker_credentials:
  11. auths:
  12. '<path-to-credentials>':
  13. auth: <username>
  14. email: <email>
  15. cluster_docker_credentials_dcos_owned: <true|false>
  16. cluster_docker_credentials_write_to_etc: <true|false>
  17. cluster_docker_credentials_enabled: <true|false>
  18. cluster_docker_registry_url: <url>
  19. cluster_name: '<cluster-name>'
  20. cosmos_config:
  21. staged_package_storage_uri: <temp-path-to-files>
  22. package_storage_uri: <permanent-path-to-files>
  23. # DC/OS Enterprise only
  24. ca_certificate_path: <path-to-certificate>
  25. ca_certificate_key_path: <path-to-private-key>
  26. ca_certificate_chain_path: <path-to-certificate-chain>
  27. custom_checks:
  28. cluster_checks:
  29. custom-check-1:
  30. description: Foobar cluster service is healthy
  31. cmd:
  32. - echo
  33. - hello
  34. timeout: 1s
  35. node_checks:
  36. checks:
  37. custom-check-2:
  38. description: Foobar node service is healthy
  39. cmd:
  40. - echo
  41. - hello
  42. timeout: 1s
  43. roles:
  44. - agent
  45. poststart:
  46. - custom-check-2
  47. dcos_overlay_enable: `<true|false>`
  48. dcos_overlay_config_attempts: <num-failed-attempts>
  49. dcos_overlay_mtu: <mtu>
  50. dcos_overlay_network:
  51. vtep_subnet: <address>
  52. vtep_mac_oui: <mac-address>
  53. overlays:
  54. - name: <name>
  55. subnet: <address>
  56. prefix: <size>
  57. dns_search: <domain1 domain2 domain3>
  58. docker_remove_delay: <num>hrs
  59. enable_docker_gc: `<true|false>`
  60. exhibitor_storage_backend: static
  61. exhibitor_storage_backend: zookeeper
  62. exhibitor_zk_hosts: `<list-of-ip-port>`
  63. exhibitor_zk_path: <filepath-to-data>
  64. exhibitor_storage_backend: aws_s3
  65. aws_access_key_id: <key-id>
  66. aws_region: <bucket-region>
  67. aws_secret_access_key: <secret-access-key>
  68. exhibitor_explicit_keys: <true|false>
  69. s3_bucket: <s3-bucket>
  70. s3_prefix: <s3-prefix>
  71. exhibitor_storage_backend: azure
  72. exhibitor_azure_account_name: <storage-account-name>
  73. exhibitor_azure_account_key: <storage-account-key>
  74. exhibitor_azure_prefix: <blob-prefix>
  75. gc_delay: <num>days
  76. log_directory: `<path-to-install-logs>`
  77. master_discovery: static
  78. master_list:
  79. - <master-private-ip-1>
  80. - <master-private-ip-2>
  81. - <master-private-ip-3>
  82. master_discovery: master_http_loadbalancer
  83. exhibitor_address: <loadbalancer-ip>
  84. master_dns_bindall: `<true|false>`
  85. num_masters: <num-of-masters>
  86. # DC/OS Open Source only
  87. oauth_enabled: `<true|false>`
  88. public_agent_list:
  89. - <agent-private-ip>
  90. platform: <platform>
  91. process_timeout: <num-seconds>
  92. rexray_config:
  93. rexray:
  94. loglevel:
  95. service:
  96. libstorage:
  97. integration:
  98. volume:
  99. operations:
  100. unmount:
  101. ignoreusedcount:
  102. server:
  103. tasks:
  104. logTimeout: 5m
  105. # DC/OS Enterprise only
  106. security: <security-mode>
  107. # DC/OS Enterprise only
  108. superuser_username: <username>
  109. ssh_key_path: <path-to-ssh-key>
  110. ssh_port: '<port-number>'
  111. ssh_user: <username>
  112. # DC/OS Enterprise only
  113. superuser_password_hash: <hashed-password>
  114. # DC/OS Enterprise only
  115. superuser_username: <username>
  116. telemetry_enabled: `<true|false>`
  117. use_proxy: `<true|false>`
  118. http_proxy: http://<proxy_host>:<http_proxy_port>
  119. https_proxy: https://<proxy_host>:<https_proxy_port>
  120. no_proxy:
  121. - '<blocked.address1.com>'
  122. - '<blocked.address2.com>'
  123. # DC/OS Enterprise only
  124. zk_super_credentials: 'super:<long, random string>'
  125. zk_master_credentials: 'dcos-master:<long, random string>'
  126. zk_agent_credentials: 'dcos-agent:<long, random string>'

示例配置

DC/OS 群集,带有内部管理的三个管理节点、五个专用代理和 Exhibitor/ZooKeeper:

  1. ---
  2. agent_list:
  3. - <agent-private-ip-1>
  4. - <agent-private-ip-2>
  5. - <agent-private-ip-3>
  6. - <agent-private-ip-4>
  7. - <agent-private-ip-5>
  8. bootstrap_url: 'file:///opt/dcos_install_tmp'
  9. cluster_name: '<cluster-name>'
  10. log_directory: /genconf/logs
  11. master_discovery: static
  12. master_list:
  13. - <master-private-ip-1>
  14. - <master-private-ip-2>
  15. - <master-private-ip-3>
  16. process_timeout: 120
  17. resolvers:
  18. - <dns-resolver-1>
  19. - <dns-resolver-2>
  20. ssh_key_path: /genconf/ssh-key
  21. ssh_port: '<port-number>'
  22. ssh_user: <username>

AWS

DC/OS 群集,带有三个管理节点、一个通过 AWS s3 bucket 备份的 Exhibitor/ZooKeeper、五个专用代理和一个公共代理节点:

  1. ---
  2. agent_list:
  3. - <agent-private-ip-1>
  4. - <agent-private-ip-2>
  5. - <agent-private-ip-3>
  6. - <agent-private-ip-4>
  7. - <agent-private-ip-5>
  8. aws_access_key_id: AKIAIOSFODNN7EXAMPLE
  9. aws_region: us-west-2
  10. aws_secret_access_key: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
  11. bootstrap_url: file:///tmp/dcos
  12. cluster_name: s3-example
  13. exhibitor_storage_backend: aws_s3
  14. exhibitor_explicit_keys: 'true'
  15. log_directory: /genconf/logs
  16. master_discovery: static
  17. master_list:
  18. - <master-private-ip-1>
  19. - <master-private-ip-2>
  20. - <master-private-ip-3>
  21. process_timeout: 120
  22. resolvers:
  23. - <dns-resolver-1>
  24. - <dns-resolver-2>
  25. s3_bucket: mybucket
  26. s3_prefix: s3-example
  27. ssh_key_path: /genconf/ssh-key
  28. ssh_port: '<port-number>'
  29. ssh_user: <username>

ZooKeeper

DC/OS 群集,带有三个管理节点、一个通过 ZooKeeper 备份的 Exhibitor/ZooKeeper、前面带有 HTTP 负载均衡器的管理节点、一个公共代理节点和 Google DNS:

  1. ---
  2. agent_list:
  3. - <agent-private-ip-1>
  4. - <agent-private-ip-2>
  5. - <agent-private-ip-3>
  6. - <agent-private-ip-4>
  7. - <agent-private-ip-5>
  8. bootstrap_url: file:///tmp/dcos
  9. cluster_name: zk-example
  10. exhibitor_storage_backend: zookeeper
  11. exhibitor_zk_hosts: 10.0.0.1:2181, 10.0.0.2:2181, 10.0.0.3:2181
  12. exhibitor_zk_path: /zk-example
  13. log_directory: /genconf/logs
  14. master_discovery: master_http_loadbalancer
  15. num_masters: 3
  16. public_agent_list:
  17. - <public-agent-private-ip>
  18. exhibitor_address: 67.34.242.55
  19. process_timeout: 120
  20. resolvers:
  21. - <dns-resolver-1>
  22. - <dns-resolver-2>
  23. ssh_key_path: /genconf/ssh-key
  24. ssh_port: '<port-number>'
  25. ssh_user: <username>

覆盖

DC/OS 群集,带有三个管理节点、一个内部管理的 Exhibitor/ZooKeeper、两个 DC/OS 虚拟网络、两个专用代理和 Google DNS:

  1. agent_list:
  2. - <agent-private-ip-1>
  3. - <agent-private-ip-2>
  4. # Use this bootstrap_url value unless you have moved the DC/OS installer assets.
  5. bootstrap_url: file:///opt/dcos_install_tmp
  6. cluster_name: <cluster-name>
  7. master_discovery: static
  8. master_list:
  9. - <master-private-ip-1>
  10. - <master-private-ip-2>
  11. - <master-private-ip-3>
  12. resolvers:
  13. # You probably do not want to use these values since they point to public DNS servers.
  14. # Instead, use values that are more specific to your particular infrastructure.
  15. - 8.8.4.4
  16. - 8.8.8.8
  17. ssh_port: 22
  18. ssh_user: centos
  19. dcos_overlay_enable: true
  20. dcos_overlay_mtu: 9001
  21. dcos_overlay_config_attempts: 6
  22. dcos_overlay_network:
  23. vtep_subnet: 44.128.0.0/20
  24. vtep_mac_oui: 70:B3:D5:00:00:00
  25. overlays:
  26. - name: dcos
  27. subnet: 9.0.0.0/8
  28. prefix: 26
  29. - name: dcos-1
  30. subnet: 192.168.0.0/16
  31. prefix: 24

HTTP 代理

DC/OS 群集,带有三个管理节点、一个内部管理的 Exhibitor/ZooKeeper、一个自定义 HTTP 代理、两个专用代理和 Google DNS:

  1. agent_list:
  2. - <agent-private-ip-1>
  3. - <agent-private-ip-2>
  4. # Use this bootstrap_url value unless you have moved the DC/OS installer assets.
  5. bootstrap_url: file:///opt/dcos_install_tmp
  6. cluster_name: <cluster-name>
  7. master_discovery: static
  8. master_list:
  9. - <master-private-ip-1>
  10. - <master-private-ip-2>
  11. - <master-private-ip-3>
  12. resolvers:
  13. # You probably do not want to use these values since they point to public DNS servers.
  14. # Instead use values that are more specific to your particular infrastructure.
  15. - 8.8.4.4
  16. - 8.8.8.8
  17. ssh_port: 22
  18. ssh_user: centos
  19. use_proxy: 'true'
  20. http_proxy: http://<user>:<pass>@<proxy_host>:<http_proxy_port>
  21. https_proxy: https://<user>:<pass>@<proxy_host>:<https_proxy_port>
  22. no_proxy:
  23. - 'foo.bar.com'
  24. - '.baz.com'

Docker 凭据

DC/OS 群集,带有三个管理节点、一个内部管理的 Exhibitor/ZooKeeper、自定义 Docker 凭据、两个专用代理和 Google DNS:

  1. agent_list:
  2. - <agent-private-ip-1>
  3. - <agent-private-ip-2>
  4. # Use this bootstrap_url value unless you have moved the DC/OS installer assets.
  5. bootstrap_url: file:///opt/dcos_install_tmp
  6. cluster_docker_credentials:
  7. auths:
  8. 'https://registry.example.com/v1/':
  9. auth: foo
  10. email: user@example.com
  11. cluster_docker_credentials_enabled: true
  12. cluster_docker_credentials_dcos_owned: true
  13. cluster_docker_registry_url: https://registry.example.com
  14. cluster_name: <cluster-name>
  15. master_discovery: static
  16. master_list:
  17. - <master-private-ip-1>
  18. - <master-private-ip-2>
  19. - <master-private-ip-3>
  20. resolvers:
  21. # You probably do not want to use these values since they point to public DNS servers.
  22. # Instead use values that are more specific to your particular infrastructure.
  23. - 8.8.4.4
  24. - 8.8.8.8
  25. ssh_port: 22
  26. ssh_user: centos

Cosmos 配置

DC/OS 群集,带有一个管理节点、一个内部管理的 Exhibitor/ZooKeeper 、三个专用代理、谷歌 DNS 和配置永久存储库的 DC/OS 包管理器 (Cosmos) :

  1. agent_list:
  2. - <agent-private-ip-1>
  3. - <agent-private-ip-2>
  4. - <agent-private-ip-3>
  5. # Use this bootstrap_url value unless you have moved the DC/OS installer assets.
  6. bootstrap_url: file:///opt/dcos_install_tmp
  7. cluster_name: <cluster-name>
  8. master_discovery: static
  9. master_list:
  10. - <master-private-ip-1>
  11. resolvers:
  12. # You probably do not want to use these values since they point to public DNS servers.
  13. # Instead use values that are more specific to your particular infrastructure.
  14. - 8.8.4.4
  15. - 8.8.8.8
  16. ssh_port: 22
  17. ssh_user: centos
  18. cosmos_config:
  19. staged_package_storage_uri: file:///var/lib/dcos/cosmos/staged-packages
  20. package_storage_uri: file:///var/lib/dcos/cosmos/packages

自定义检查

DC/OS 群集,带有一个管理节点、一个内部管理的 Exhibitor/ZooKeeper、三个专用代理、谷歌DNS和自定义运行状况检查,确定用于:

  • 用户 Marathon 实例(user-marathon-on-marathon
  • 管理节点上的本地装载(master-mounts
  • 代理节点上的本地装载(agent-mounts
  1. agent_list:
  2. - <agent-private-ip-1>
  3. - <agent-private-ip-2>
  4. - <agent-private-ip-3>
  5. # Use this bootstrap_url value unless you have moved the DC/OS installer assets.
  6. bootstrap_url: file:///opt/dcos_install_tmp
  7. cluster_name: <cluster-name>
  8. master_discovery: static
  9. master_list:
  10. - <master-private-ip-1>
  11. resolvers:
  12. # You probably do not want to use these values since they point to public DNS servers.
  13. # Instead use values that are more specific to your particular infrastructure.
  14. - 8.8.4.4
  15. - 8.8.8.8
  16. ssh_port: 22
  17. ssh_user: centos
  18. custom_checks:
  19. cluster_checks:
  20. user-marathon-on-marathon:
  21. description: The user Marathon-on-Marathon is healthy
  22. cmd:
  23. - "check_marathon"
  24. - "--location"
  25. - "user-marathon.marathon.mesos"
  26. timeout: 5s
  27. node_checks:
  28. checks:
  29. master-mounts:
  30. description: Local mounts on masters are present
  31. cmd:
  32. - check_mounts
  33. - "--role"
  34. - "master"
  35. roles:
  36. - master
  37. timeout: 5s
  38. agent-mounts:
  39. description: Local mounts on agents are present
  40. cmd:
  41. - check_mounts
  42. - "--role"
  43. - "agent"
  44. roles:
  45. - agent
  46. timeout: 5s