Skip to content

IBM/conversation-simple-k8s

Repository files navigation

Kubernetes Secret example

This repo is a companion to the developerWorks Mailbag video Using Kubernetes secrets to manage credentials.

You'll find everything you need to:

  • Build a Docker image from the Rameses II chatbot app
  • Create a Kubernetes secret to store the credentials for the app
  • Deploy the app to a Kubernetes cluster.

Acknowledgements

This repo is based on the Watson Developer Cloud team's awesome conversation-simple application. Many thanks to that team for their excellent work.

Before you begin

Some background, if you want it

All of the steps involved in creating the chatbot app, building the docker image, and creating the Kubernetes cluster are covered in the following developerWorks Mailbag videos:

If you go through all the exercises in those videos, you'll have the same starting point as the companion video for this repo. However, you can use the techniques we cover with any Docker image containing any application you choose. Feel free to use your own app instead.

Setting up the Conversation service

You can use an existing instance of the Conversation service if you have one. If you want a guided tour for creating a new service, the developerWorks Mailbag video Building chatbots in the IBM Cloud - Part 1 covers this around the 2:00 mark.

Importing the Conversation workspace

From the IBM Cloud console, click on your Conversation Service in the list of services, then click the Import icon to import the file RoyalValet.json into the service. Be sure to import everything, including the entities, intents, and dialogs.

Details of importing data into a Conversation Service are in the video Building chatbots in the IBM Cloud - Part 1 around the 9:05 mark.

The preliminaries

Before you go through the steps in this video, we assume you have a Docker image that contains an app that needs credentials. If you've followed the video series, you've done the following steps:

  1. Built a Docker image from the code in the repo. The repo contains a Dockerfile and a .dockerignore file to make this easy.
  2. Uploaded that Docker image to your IBM Cloud repository.
  3. Used the IBM Cloud console to get the credentials for your conversation service. You'll need the values for WORKSPACE_ID, CONVERSATION_USERNAME, and CONVERSATION_PASSWORD.
  4. Used the IBM Cloud console to create a cluster. (If you'd like to continue your tour of dW Mailbag videos, you can find the cluster creation details around the 1:50 mark of Building a Kubernetes cluster in the IBM Cloud.)
  5. Configured the kubectl command to point to your cluster. (If you need to see how to do that, the details are at the 5:45 mark in the Building a Kubernetes cluster in the IBM Cloud video.)

Der plan

Whew. In a nutshell, here's what you'll do:

  1. Create a Kubernetes secret that contains the credentials of your conversation service. You'll create this with the convo-secret.yaml file.
  2. Deploy the Docker image containing your app to your cluster using the convo-deployment.yaml file.
  3. Do some magic (covered in the video) with the kubectl command.
  4. Have fun with your chatbot, now running live on the web.
  5. Share the URL with your friends and family so they can share your joy.

License

This sample code is licensed under Apache 2.0. Full license text is available in LICENSE.

Contributing

See CONTRIBUTING.

Open Source @ IBM

Find more open source projects on the IBM Github Page.