【问题标题】:How to set up chef workstation without that being a chef client itself如何在不成为厨师客户的情况下设置厨师工作站
【发布时间】:2015-02-15 03:05:24
【问题描述】:

在谈到厨师术语时,我似乎很麻烦。大多数教程都假设用户已经熟悉这些术语。在其中一个之后,我得到了 chef-client 和 chefdk。我想做的就是能够设置工作站并引导一个节点。

这是我的设置:

  • 工作站:ubuntu 14.04 笔记本电脑(无意成为客户端)一个
  • 托管厨师帐户:我订阅了 5 个节点帐户 3 个虚拟机上的一个
  • 我想要控制和使用的主机来查看厨师的实际操作

在这里和那里阅读,我认为我需要以下内容:

  • client.rb : 到目前为止还不知道如何获取它以及它的作用
  • knife.rb:从启动 kip 复制到 /etc/chef/(它只在那里查找)
  • username.pem :我猜想在工作站和主厨之间进行身份验证:服务器左右
  • organization-validation.pem : 我猜是节点和服务器之间的身份验证。

所以我把 knife.rb ,username.pem 和 validation.pem(renamed organization-validation.pem) 放在 /etc/chef 下。我还在我的~/.bash_profile 中添加了以下内容:

PATH=$PATH:$HOME/.local/bin:$HOME/bin
PATH=$PATH:/opt/chefdk/bin
export PATH

所以当运行我的引导命令时:

knife bootstrap server1.domain.com -x user -P pass -N server1 

##knife bootstrap output

WARNING: No knife configuration file found
Connecting to server1.domain.com
server1.domain.com Starting first Chef Client run...
server1.domain.com [2014-12-16T16:55:02+00:00] WARN: 
server1.domain.com SSL validation of HTTPS requests is disabled. HTTPS connections are still
server1.domain.com encrypted, but chef is not able to detect forged replies or man in the middle
server1.domain.com attacks.
server1.domain.com To fix this issue add an entry like this to your configuration file:
server1.domain.com   # Verify all HTTPS connections (recommended)
server1.domain.com   ssl_verify_mode :verify_peer
server1.domain.com   # OR, Verify only connections to chef-server
server1.domain.com   verify_api_cert true
server1.domain.com To check your SSL configuration, or troubleshoot errors, you can use the
server1.domain.com `knife ssl check` command like so:
server1.domain.com   knife ssl check -c /etc/chef/client.rb
server1.domain.com Starting Chef Client, version 11.16.4
server1.domain.com Creating a new client identity for logsmanager using the validator key.
server1.domain.com [2014-12-16T16:55:04+00:00] ERROR: Connection refused connecting to  https://localhost/clients, retry 1/5
server1.domain.com [2014-12-16T16:55:09+00:00] ERROR: Connection refused connecting to https://localhost/clients, retry 2/5
server1.domain.com [2014-12-16T16:55:14+00:00] ERROR: Connection refused connecting to https://localhost/clients, retry 3/5
server1.domain.com [2014-12-16T16:55:19+00:00] ERROR: Connection refused connecting to https://localhost/clients, retry 4/5
server1.domain.com [2014-12-16T16:55:24+00:00] ERROR: Connection refused connecting to https://localhost/clients, retry 5/5
server1.domain.com Network Error:
server1.domain.com There was a network error connecting to the Chef Server:
server1.domain.com Connection refused - Connection refused connecting to   https://localhost/clients, giving up
server1.domain.com Relevant Config Settings:
server1.domain.com chef_server_url  "https://localhost:443"
server1.domain.com If your chef_server_url is correct, your network could be down.
server1.domain.com [2014-12-16T16:55:29+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
server1.domain.com Chef Client failed. 0 resources updated in 27.268943154 seconds
server1.domain.com [2014-12-16T16:55:29+00:00] ERROR: Connection refused - Connection  refused connecting to https://localhost/clients, giving up
server1.domain.com [2014-12-16T16:55:29+00:00] FATAL:    Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

很明显我迷路了,谁能让我走上正确的道路。请 。谢谢

编辑 1

下面是knife.rb文件

# See https://docs.chef.io/config_rb_knife.html for more information on knife     configuration options

current_dir = File.dirname(__FILE__)
log_level                :info
log_location             STDOUT
node_name                "username"
client_key               "#{current_dir}/username.pem"
validation_client_name   "organization-validator"
validation_key           "#{current_dir}/organizationname-validator.pem"
chef_server_url          "https://api.opscode.com/organizations/organizationname"
cache_type               'BasicFile'
cache_options( :path => "#{ENV['HOME']}/.chef/checksums" )
cookbook_path            ["#{current_dir}/../cookbooks"]

【问题讨论】:

  • 请张贴您的knife.rb文件的内容。
  • 你好@TejayCardon 我更新了帖子
  • knife 期望找到此文件的默认位置是~/.chef/knife.rb - 您是否尝试过解决“未找到刀配置文件”?它还尝试使用https://localhost/clients 的服务器网址,但您的刀文件显示https://api.opscode.com。您的配置似乎不止一个问题,所以很难弄清楚从哪里开始

标签: chef-infra bootstrapping


【解决方案1】:
WARNING: No knife configuration file found

它没有找到您的knife.rb 文件。结果,它使用了一个默认配置,在 localhost 中查找厨师服务器:

server1.domain.com chef_server_url  "https://localhost:443"

通常knife.rb 在~/.chef/knife.rb 中,但它也应该在/etc/chef/knife.rb 中。也许您有权限问题?无论如何,我会把它移到标准的~/.chef/knife.rb

【讨论】:

  • 你也可以设置一个环境变量:export KNIFE_HOME=/path/to/knife_conf_directory 当你在同一个工作站使用多个厨师服务器时非常有用。
【解决方案2】:

将您的 Chef 服务器的条目添加到您节点的 /etc/hosts 文件中。

【讨论】:

    猜你喜欢
    • 2014-03-09
    • 1970-01-01
    • 2015-03-06
    • 2015-02-25
    • 2013-05-23
    • 1970-01-01
    • 1970-01-01
    • 2015-11-11
    • 1970-01-01
    相关资源
    最近更新 更多