New Microsoft Teams Integration: Check it Out Here
Botkube blog

Integrating Microsoft Teams with Azure for K8s Deployments

Oct 30, 2023
15 min
read
Maria Ashby
Developer Advocate
Botkube

Botkube is entering the MS teams world

Share on Twitter
Share on LinkedIn
Share on Reddit
Share on HackerNews
Copy URL

Table of Contents

Manage your Kubernetes Clusters Directly in Slack and MS Teams!

Start Receiving Kubernetes Notifications Now with Botkube Cloud

As Microsoft Teams continues its steady rise as the go to platform for enterprise-level workplace collaboration, it is parallel to the rapid adoption of Azure and Azure Kubernetes Service (AKS). These collective forces drive organizations toward innovation, scalability, and streamlined cloud-native application deployment. However, this highlights a major challenge: as teams begin to incorporate Kubernetes and all of its complexities into their workflows, the need for a collaborative troubleshooting tool becomes essential. 

Enter Botkube - a Kubernetes troubleshooting and monitoring tool designed to empower DevOps teams to work more efficiently. Botkube has now expanded its capabilities to seamlessly integrate with Microsoft Teams, fostering collaborative troubleshooting tailored to your organization's Teams workspace. 

Botkube has a new version of MS Teams. It is easy to install and get up in running in five minutes or less. Click here to find out more! 

Benefits of Using Botkube and MS Teams

Botkube’s integration offers useful features for Microsoft users working with Azure Kubernetes Service (AKS). It simplifies interactions with Kubernetes and the broader cloud-native ecosystem. With the Botkube plugin system, users can easily integrate tools like Prometheus for monitoring and Helm for application package management within the Microsoft ecosystem. With Botkube, you can manage your deployments with Helm and customize your alerting set with Prometheus directly in Teams! This integration facilitates smoother deployment processes and more consistent monitoring. 

Botkube empowers developers with self-service access while ensuring a controlled and secure environment. It offers a controlled environment for developers to access their Kubernetes resources. It enables the whitelist of potent commands like 'create' and 'delete,' allowing developers to experiment with Kubernetes tools without granting them full control over the clusters. This is particularly useful for enterprise teams because it allows for a balance between developer autonomy and maintaining security standards. In essence, Botkube enhances the AKS experience by streamlining tool integration and offering controlled access for developers.

Tutorial Guide 

In this tutorial, we will guide you through the step-by-step process of configuring and leveraging Botkube for Microsoft Teams and AKS. This enhancement empowers your team to efficiently establish a connection between Kubernetes and Microsoft Teams, facilitating the streamlined management of multiple Kubernetes clusters and significantly improving incident resolution times.

Prerequisites

  • Botkube Cloud account
  • Access to a Kubernetes cluster
  • MS Teams account

Create a Custom App in Microsoft Teams 

  1. Log into the Developer Portal for Teams.
  2. Click on the Apps left-hand side menu item and choose New app
  3. In the Add app pop-up, provide an app name (e.g., Botkube).
  4. Your app should now be listed in the Apps table. Click the app to continue.
  5. Fill in the App details in the Configure/Basic information section as follows:

App name / Short name: Botkube

Descriptions / Short description: Botkube is a bot for your Kubernetes cluster.

Descriptions / Long description: Botkube helps you monitor your Kubernetes cluster, debug critical deployments, and gives recommendations for standard practices by running checks on the Kubernetes resources.

Version: 1.5.0

Developer Information / Developer: Botkube

Developer Information / Website: https://botkube.io

App URLs / Privacy policy: https://botkube.io/privacy

App URLs / Terms of use: https://botkube.io/license

Application (client) ID: Add the Application (client) ID you obtained from Azure Active Directory.

6. Click the Save button to save your app details.

Configure the Botkube Branding 

1. Navigate to Branding on the left-hand side menu item and click to open the Branding section.

2. Download Botkube icons from here and update Branding icons.

Add the Bot Feature to the App

  1. On the left-hand side menu, click Configure / App features.
  2. In App features click the "Bot" button.
  3. In Select an existing bot, select the bot you just created.

4. In Identify your bot enable: 

  • What can your bot do?: Upload and download files
  • Select the scopes in which people can use this command: Personal & Team
  • Then click Save.

Install Bot to Teams.

  • Go to Publish to org.
  • Click on Publish your app to install the Botkube app on MS Teams.

Deploying Botkube

There are two methods to deploy Botkube: 

Terraform 

Prerequisites

  • Terraform Cloud Account 
  • Azure Account
  • Github Account

Collect Azure Credentials for Terraform Cloud

  1. Before you start setting up the environment, you need to collect the Azure credentials required for Terraform Cloud.
  2. You can see the credentials needed for Azure in this documentation
  3. Make note of the following environment variables, which you will need for Terraform integration

- ARM_CLIENT_ID

 - ARM_CLIENT_SECRET

 - ARM_TENANT_ID

 - ARM_SUBSCRIPTION_ID 

 Create a Workspace in Terraform Cloud

  •  Log in to your Terraform Cloud account.
  •  Create a new workspace by clicking on Workspaces and then Create a New Workspace.
  • Connect your GitHub account with Terraform Cloud and select the forked repository as the source.
  • Do not trigger any runs yet. We'll configure the workspace variables first.
  • Inside your newly created workspace, go to the Settings tab.
  • Click on Workspace Variables to add the following parameters:

- ARM_CLIENT_ID

            - ARM_CLIENT_SECRET

            - ARM_TENANT_ID

            - ARM_SUBSCRIPTION_ID

  • Set the values for these variables based on the Azure credentials you collected in 
  • Navigate to the "Runs" tab within your Terraform Cloud workspace.
  • Start a new run by clicking on the "Start new run" button.
  • You can monitor the progress of the run in the "Runs" tab. Wait until everything is created successfully.
  • Once the Terraform deployment is complete, you can access Botkube in MS Teams. 
  • Log in to your Azure account and navigate to the Kubernetes cluster created during the Terraform deployment.
  • You will find a public domain URL similar to this: `https://botkube.centralus.cloudapp.azure.com/bots/teams/v1/messages`.
  • Use this URL as the Bot configuration endpoint address in Microsoft Teams.
  • Congratulations! You have successfully set up Botkube for Microsoft Teams on Azure AKS using Terraform Cloud. You can now utilize Botkube for managing Kubernetes notifications and interactions within your MS Teams environment.

Manual setup 

Prerequisites

  • A domain name with DNS configuration capabilities.
  • TLS certificate and key for your registered domain name to enable SSL termination.
  • An nginx-ingress controller deployed on your Kubernetes cluster.

Deploy Botkube 

  • Create a Kubernetes TLS Secret in the botkube namespace. This secret will be used for securing communication. 
  • Replace /path/to/cert.pem and /path/to/privatekey.pem with the actual paths to your TLS certificate and private key.

kubectl create namespace botkube

kubectl create secret tls botkube-tls -n botkube --cert=/path/to/cert.pem --key=/path/to/privatekey.pem

  • Deploy the Botkube agent in your Kubernetes cluster with the following commands.
  • Replace the placeholders with your specific values.

```yaml
export CLUSTER_NAME={cluster_name}
export ALLOW_KUBECTL={allow_kubectl}
export ALLOW_HELM={allow_helm}
export HOST={host} # e.g., example.com
botkube install --version v1.5.0 --namespace botkube \
--set communications.default-group.teams.enabled=true \
--set communications.default-group.teams.appID=${APPLICATION_ID} \
--set communications.default-group.teams.appPassword=${APPLICATION_PASSWORD} \
--set communications.default-group.teams.botName=${BOT_NAME} \
--set settings.clusterName=${CLUSTER_NAME} \
--set 'executors.k8s-default-tools.botkube/kubectl.enabled'=${ALLOW_KUBECTL} \
--set 'executors.k8s-default-tools.botkube/helm.enabled'=${ALLOW_HELM} \
--set ingress.create=true \
--set ingress.host=${HOST} \
--set ingress.tls.enabled=true \
--set ingress.tls.secretName=botkube-tls

```

APPLICATION_ID is the Botkube application ID generated during registration in Teams.

APPLICATION_PASSWORD is the Botkube application password generated during registration in Teams.

BOT_NAME is the name you assigned to the Botkube bot during registration (usually Botkube).

CLUSTER_NAME should match the cluster name set in incoming messages.

ALLOW_KUBECTL should be set to true to allow kubectl command execution by Botkube on the cluster.

ALLOW_HELM should be set to true to allow helm command execution by Botkube on the cluster.

HOST is the hostname of the endpoint provided during Botkube registration.

  • Curl on the endpoint to confirm that the Botkube endpoint is reachable and serving the requests.
  • If you encounter a 404 error, please double-check the ingress configuration or the endpoint you configured during app registration.

curl -k https://<HOST>/<URLPATH> Authentication headers are missing in the request # Expected response

Add Botkube to a Teams Channel

  • In Teams, go to Apps and select Botkube.
  • Click the drop-down option next to the Open button and choose Add to a team.
  • Select the name of the channel in which you want to receive notifications.
  •  Once added, navigate to the channel and type @Botkube ping to ensure that Botkube is responding.
  • If Botkube responds, you can send @Botkube enable notifications to activate notifications in the channel.
  • Congratulations! You have successfully deployed Botkube for Microsoft Teams!

Conclusion

The new Botkube Microsoft Teams integration offers an all-in-one solution for MS Teams users. This integration enhances the Azure Kubernetes experience by simplifying interactions with Kubernetes and the broader cloud-native ecosystem. Botkube’s features like real-time notifications support across multiple channels streamline deployment management and open up a range of potential use cases for incident response management and troubleshooting. This integration empowers developers with self-service access while ensuring control and security, making it a valuable tool for enterprise teams seeking a balance between autonomy and compliance with security standards.

Check out Botkube Microsoft Teams integration here.

Get Started with Botkube

Whether you're a seasoned Kubernetes pro or just getting started, Botkube can help supercharge your troubleshooting process. Sign up now for free and join the community of users who are already benefiting from the power of Botkube. 

We want to know what you think of Botkube and how we can make it even better. Email our Developer Advocate, Maria or schedule a quick 15 meeting at your preferred time. As a thank you, we’ll send you some great Botkube swag!