Skip to end of metadata
Go to start of metadata


Overview

Knife is a command-line tool that comes with Chef.
It is used by administrators to interact with the Chef Server API, the local Chef repository and and can be used to create, edit, view, list, and delete API clients.


Knife's client sub-command provides the ability to manage API clients.

For more information about Knife, refer to the Knife documentation.
See API Clients for more information on API Clients.

       
Knife commands all have the same form



The following client arguments are available:

bulk delete

Delete clients where the client name matches the regular expression [regex] on the Chef Server. The regular expression should be given as a quoted string, and not surrounded by forward slashes.
Usage:

create

Create a new client. This generates an RSA keypair. The private key will be displayed on STDOUT or written to the named file. The public half will be stored on the Server. For chef-client systems, the private key should be copied to the system as /etc/chef/client.pem. If you do not copy the key and try running chef-client for the first time without it, you will get a 403 error because you won't have sufficient permissions to re-create the key.

Admin clients should be created for users that will use knife to access the API as an administrator. The private key will generally be copied to ~/.chef/client_name.pem and referenced in the knife.rb configuration file. Hosted Chef users should note that marking clients as "Admin clients" will have no effect when using Hosted Chef.

Usage:

Additional Options:

  • -a, --admin:
    Create the client as an admin
  • -f, --file FILE:
    Write the key to a file

delete

Deletes a registered client.

Usage:

edit

Edit a registered client.

Usage:

The clients record will be open with EDITOR and can be edited by the user.

list

List all registered clients

Usage:

Additional Options:

  • -w, --with-uri:
    Show corresponding URIs

Example Output:

reregister

Regenerate the RSA keypair for a client. The public half will be stored on the server and the private key displayed on STDOUT or written to the named file. This operation will invalidate the previous keypair used by the client, preventing it from authenticating with the Chef Server. Use care when reregistering the validator client.

Usage:

Additional Options:

  • -f, --file FILE:
    Write the key to a file

show

Show a client. Output format is determined by the --format option.

Usage:

Additional Options:

  • -a, --attribute ATTR:
    Show only one attribute

Example Output







Launch Cloud Instances with Knife


Managing Cookbooks With Knife



Labels:
None
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.