Skip to content

Profiles

RCTL support helps to automate the lifecycle of operations associated with Cost Management Profiles.

Resource Create Get Delete Share
Profiles YES YES YES Yes

The declarative method allows the users to create Cost Management Profiles to ensure that custom pricing can be taken into consideration.

Profiles

Create Profile

Run the below command to create a Cost Management Profile using the spec yaml file.

./rctl apply -f profile_filename.yaml

An illustrative example of the AWS profile shared between 2 projects spec YAML file is shown below.

apiVersion: cost.k8smgmt.io/v3
kind: CostProfile
metadata:
  name: <cost_profile_name>
  description: "Cost Profile description"
  project: <project_name>
spec:
  version: <version_name>
  providerType: <provider_type>
  sharing:
    enabled: true
    projects:
    - name: <to_project_name_1>
    - name: <to_project_name_2>
  installationParams:
    aws:
      spotIntegration:
        spotLabel: <spot_label>
        spotLabelValue: <spot_label_value>
        awsSpotDataRegion: <aws_spot_data_region>
        awsSpotDataBucket: <aws_spot_data_bucket>
        awsSpotDataPrefix: <aws_spot_data_prefix>
        awsAccountId: <aws_account_id>
      curIntegration:
        athenaRegion: <athena_region>
        athenaBucketName: <athena_bucket_name>
        athenaDatabase: <athena_database>
        athenaTable: <athena_table>
        masterPayerArn: <master_payer_Arn>
        awsAccountId: <aws_account_id>
      awsCredentials:
        cloudCredentialsName: <cloud_credentials_name>

An illustrative example of a spec YAML file for sharing profiles with all projects is show below.

apiVersion: cost.k8smgmt.io/v3
kind: CostProfile
metadata:
  name: <cost_profile_name>
  description: "Cost Profile description"
  project: <project_name>
spec:
  version: <version_name>
  providerType: <provider_type>
  sharing:
    enabled: true
    projects:
    - name: '*'
  version: v1.0

Get Profile

Use any of the below commands to get the list of all Cost Management Profiles (or) a specific project

S. No Command
1 ./rctl get costprofile -p <project-name>
2 ./rctl get cp -p <project-name>
3 ./rctl get costprofile
4 ./rctl get cp

Example Output

./rctl get cp -p default-project
+----------------------+-------------------+
| PROFILE NAME         | VERSION NAME      |
+----------------------+-------------------+
| demo-profile         | v1                |
+----------------------+-------------------+
| cost-profile1        | v2.0              |
+----------------------+-------------------+
| test-costprofile     | v2.1              |
+----------------------+-------------------+

Delete Profile

To delete a profile, use the below command

./rctl delete costprofile <profile name>

(or)

./rctl delete cp <profile name>

Enabling Cost Management and attaching Cost Profile in a Blueprint

Once the Cost Management Profiles are created, users can deploy the Cost Management via blueprint spec yaml. Refer Blueprint CLI for both the declarative and imperative RCTL commands.

An illustrative example of the blueprint spec YAML with Cost Management parameters is shown below.

apiVersion: infra.k8smgmt.io/v3
kind: Blueprint
metadata:
  name: demo-bp
  project: defaultproject
spec:
  base:
    name: default
    version: 1.18.0
  defaultAddons:
    csiSecretStoreConfig:
      providers: {}
    enableIngress: false
    enableLogging: false
    enableMonitoring: true
    enableVM: false
  drift:
    enabled: false
  costProfile:
    enabled: true
    name: "cprole2"
    version: "v1"
  networkPolicy: {}
  opaPolicy: {}
  placement: {}
  prometheusCustomization: {}
  sharing:
    enabled: false
  type: custom
  version: v5