这是我的工作,可以从快照包管理器安装kubectl
- name: Install the kubectl snap package
snap:
name: kubectl
channel: "1.13/stable"
classic: yes
state: present
但是我遇到了以下错误
> {"changed": false, "channel": "1:13/stable", "classic": true, "cmd":
> "sh -c \"/usr/bin/snap install --classic --channel 1:13/stable
> kubectl\"", "msg": "Ooops! Snap installation failed while executing
> 'sh -c \"/usr/bin/snap install --classic --channel 1:13/stable
> kubectl\"', please examine logs and error output for more details.",
> "rc": 1, "stderr": "error: snap \"kubectl\" is not available on
> 1:13/stable but is available to\n install on the following
> tracks:\n\n latest/stable snap install --stable kubectl\n
> 1.17/stable snap install --channel=1.17 kubectl\n 1.16/stable snap install --channel=1.16 kubectl\n 1.15/stable snap
> install --channel=1.15 kubectl\n 1.14/stable snap install
> --channel=1.14 kubectl\n 1.13/stable snap install --channel=1.13 kubectl\n 1.12/stable snap install --channel=1.12 kubectl\n 1.11/stable snap install --channel=1.11 kubectl\n 1.10/stable snap install --channel=1.10 kubectl\n 1.9/stable snap install --channel=1.9 kubectl\n 1.8/stable snap install --channel=1.8 kubectl\n 1.7/stable snap install --channel=1.7 kubectl\n 1.6/stable snap install --channel=1.6 kubectl\n 1.5/stable snap install --channel=1.5 kubectl\n\n Please be mindful that different tracks may include different features.\n Get more information
> with 'snap info kubectl'.\n", "stderr_lines": ["error: snap
> \"kubectl\" is not available on 1:13/stable but is available to", "
> install on the following tracks:", "", " latest/stable snap
> install --stable kubectl", " 1.17/stable snap install
> --channel=1.17 kubectl", " 1.16/stable snap install --channel=1.16 kubectl", " 1.15/stable snap install --channel=1.15 kubectl", " 1.14/stable snap install --channel=1.14 kubectl", " 1.13/stable snap install --channel=1.13 kubectl", " 1.12/stable snap install --channel=1.12 kubectl", " 1.11/stable snap install --channel=1.11 kubectl", " 1.10/stable snap install --channel=1.10 kubectl", " 1.9/stable snap install --channel=1.9 kubectl", " 1.8/stable snap install --channel=1.8 kubectl", " 1.7/stable snap install --channel=1.7 kubectl", " 1.6/stable snap install --channel=1.6 kubectl", " 1.5/stable snap install --channel=1.5 kubectl", "", " Please be mindful that different tracks may include different features.", " Get more information
> with 'snap info kubectl'."], "stdout": "", "stdout_lines": []}
答案 0 :(得分:2)
剧本按预期进行。
- name: Install the kubectl snap package
snap:
name: kubectl
channel: "1.13/stable"
classic: yes
state: present
$ kubectl version
Client Version: version.Info{Major:"1", Minor:"13", GitVersion:"v1.13.12", GitCommit:"a8b52209ee172232b6db7a6e0ce2adc77458829f", GitTreeState:"clean", BuildDate:"2019-10-17T19:01:20Z", GoVersion:"go1.12.10", Compiler:"gc", Platform:"linux/amd64"}
您的错误消息指出它未能安装1:13/stable
版本的kubectl。
Ooops! Snap installation failed while executing 'sh -c \"/usr/bin/snap install --classic --channel 1:13/stable kubectl\"', please examine logs and error output for more details.
执行剧本时,您可能键入了错误的频道版本。该频道必须是here列出的频道之一。