示例

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