Use rpk profiles to simplify your development experience using
rpk with multiple Redpanda clusters by saving and reusing configurations for different clusters.
An rpk profile contains a reusable configuration for a Redpanda cluster. When running
rpk, you can create a profile, configure it for a cluster you’re working with, and use it repeatably when running an
rpk command for the cluster.
You can create different profiles for different Redpanda clusters. For example, your local cluster, development cluster, and production cluster can each have their own profile, with all of their information managed locally by rpk. You set a unique name for each profile.
A profile saves rpk-specific command properties. For details, see Specifying command properties.
rpk commands can read configuration values from a profile. You pass a profile to an
rpk command by setting the
--profile flag. For example, the command
rpk topic produce dev-topic --profile dev gets its configuration from the profile named
The primary tasks for working with rpk profiles:
Create one or more profiles.
Choose the profile to use.
Edit or set default values across all profiles and values for a single profile.
rpkcommand with a profile.
Delete unused profiles.
To create a new profile, run
rpk profile create:
rpk profile create <profile-name> [flags]
An rpk profile can be generated from different sources:
redpanda.yamlfile, using the
A different rpk profile, using the
A Redpanda Cloud cluster, using the
You must provide a profile name when creating a profile that isn’t generated from a Redpanda Cloud cluster with the
After the profile is created, rpk switches to the newly created profile.
You can specify the configuration during creation with the
--set [key=value] flag. To simplify configuration, the
--set flag supports autocompletion of valid keys, suggesting key names based on their
You should always use and set the
--description flag to describe your profiles. The description is printed in the output of
rpk profile list.
Created profiles are stored in an
rpk.yaml file in a default local OS directory (for example,
~/.config/rpk/ for Linux and
~/Library/Application Support/rpk/ for MacOS). All profiles created by a developer are stored in the same
With multiple created profiles, choose the profile to use with
rpk profile use:
rpk profile use <name-of-profile-to-use>
You can configure settings that apply to all profiles. To set these
You can customize settings for a single profile. To set a profile’s configuration:
A configurable field of an rpk profile is the
prompt field. It enables the customization of the command prompt for a profile, so information about the in-use profile can be displayed within your command prompt.
The format string is intended for a
PS1 prompt. For details on the prompt format string, see the
rpk profile prompt reference.
rpk profile prompt command prints the ANSI-escaped text of the
prompt field for the in-use profile. You can call
rpk profile prompt in your shell’s (rc) configuration file to assign your
For example, to customize your bash prompt for a
dev rpk profile , first call
rpk profile edit dev to set its
prompt: hi-red, "[%n]"
hi-redsets the text to high-intensity red
%nis a variable for the profile name
PS1 to include a call to
rpk profile prompt:
export PS1='\u@\h\n$(rpk profile prompt)% '
When setting your
PS1 variable, use single quotation marks and not double quotation marks, because double quotation marks aren’t reevaluated after every command.
The resulting prompt looks like this:
An rpk command that can use a profile supports the
--profile <profile-name> flag. When the
--profile flag is set for an rpk command, the configuration for the cluster that rpk is interfacing with will be read from the named profile.
See the rpk commands reference for commands that support profiles.
To delete a profile, run
rpk profile delete.
For details about all commands for rpk profiles, see the
rpk profile reference page and its sub-pages.