Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Unable to use kubectl commands #440

Closed
hjpotter92 opened this issue Dec 31, 2020 · 4 comments
Closed

[BUG] Unable to use kubectl commands #440

hjpotter92 opened this issue Dec 31, 2020 · 4 comments
Labels
bug Something isn't working

Comments

@hjpotter92
Copy link

hjpotter92 commented Dec 31, 2020

Describe the bug
We have deployed the app to our organisations slack channels. The settings specific to kubectl commands is as follows:

    # Setting to support multiple clusters
    settings:
      # Cluster name to differentiate incoming messages
      clustername: oga
      # Kubectl executor configs
      kubectl:
        # Set true to enable kubectl commands execution
        enabled: true
        commands:
          # method which are allowed
          verbs: ["api-resources", "api-versions", "cluster-info", "describe", "diff", "explain", "get", "logs", "top", "auth"]
          # resource configuration which is allowed
          resources: ["deployments", "pods" , "namespaces", "daemonsets", "statefulsets", "storageclasses", "nodes"]
        # set Namespace to execute botkube kubectl commands by default
        defaultNamespace: dev
        # Set true to enable commands execution from configured channel only
        restrictAccess: true

To Reproduce

When using any of the commands (except for ping) from the authorised slack channel, the botkube logs the following message:

DEBU[2020-12-31T08:44:58Z] Slack incoming message: &{Msg:{Type:message Channel:XXXXXXXXX User:XXXXXX Text:<@XXXXXXXXX> get pods Timestamp:1609404298.188500 ThreadTimestamp: IsStarred:false PinnedTo:[] Attachments:[] Edited:<nil> LastRead: Subscribed:false UnreadCount:0 SubType: Hidden:false DeletedTimestamp: EventTimestamp:1609404298.188500 BotID: Username: Icons:<nil> Inviter: Topic: Purpose: Name: OldName: Members:[] ReplyCount:0 Replies:[] ParentUserId: Files:[] Upload:false Comment:<nil> ItemType: ReplyTo:0 Team:XXXXXXXX Reactions:[] ResponseType: ReplaceOriginal:false DeleteOriginal:false Blocks:{BlockSet:[]}} SubMessage:<nil> PreviousMessage:<nil>}
INFO[2020-12-31T08:44:58Z] Invalid request. Dumping the response

and no response is sent back to the slack channel or the user.

Expected behavior
The commands' output should be shown in the slack channel.

@hjpotter92 hjpotter92 added the bug Something isn't working label Dec 31, 2020
@PrasadG193
Copy link
Collaborator

@hjpotter92, I see you are setting restrictedAccess: true in the config. Setting that will executing commands only from the channel you get notifications in. Can you please check if you are running the command in the correct Slack channel?

@hjpotter92
Copy link
Author

@PrasadG193 yes. I have the following slack configuration:

      slack:
        enabled: true
        channel: '#k8s-feed'

and I am indeed sending message inside that channel

ping is the only command that works

2020-12-31_15_23_32

@PrasadG193
Copy link
Collaborator

PrasadG193 commented Dec 31, 2020

Hey @hjpotter92, can you try giving Slack channel name without # prefix in the config?

@hjpotter92
Copy link
Author

Removing the # prefix does work now.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants