Cluster

Kubernetes 和 ansible - 缺少模組

  • June 2, 2017

我正在嘗試在我的 Kubernetes 集群上使用 Ansible 部署應用程序。我嘗試使用這個模組kubernetes 集群模組,但是當我嘗試執行從文件複製的範例劇本時,我得到:

 [WARNING]: Host file not found: /etc/ansible/hosts

 [WARNING]: provided hosts list is empty, only localhost is available

ERROR! 'kubernetes' is not a valid attribute for a Play

The error appears to have been in '/home/holo/enterpryze/sources/devops/orchiestration/environment-cloud/ansible-playbook/kube.yaml':
line 1, column 3, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:


- name: Create a kubernetes namespace
  ^ here

如何添加此模組以使我的範例配置正常工作?

顯然存在語法錯誤。

不是 Play 的有效屬性

您應該將模組呼叫放在tasks部分下(注意縮進):

- hosts: server
 tasks:
   - name: mytask
     kubernetes:

引用自:https://serverfault.com/questions/853660