Appendix A. Configuring Kubernetes as Used in This Book

Throughout this book, we use two Kubernetes providers: one to demonstrate Kubernetes as a managed service, which you can run in IBM’s worldwide datacenters; and the second to demonstrate Kubernetes as a software package that you can install on your infrastructure of choice.

Configuring IBM Cloud Private in Your Datacenter

The following section describes how to configure IBM Cloud Private and the supporting command-line interface to use when running the examples discussed in this book.

Configuring an IBM Cloud Private Kubernetes Cluster

There are a number of ways to get started with your own enterprise-grade Kubernetes cluster on your own infrastructure.

First, as a software distribution of Kubernetes, you can deploy IBM Cloud Private on your own infrastructure (VMware, bare metal, OpenStack) or various public cloud providers. Visit the GitHub repository for ready-to-go automation.

For local experiments, you can simulate a multiworker cluster on your own laptop via the following code:

git clone https://github.com/IBM/deploy-ibm-cloud-private.git
cd deploy-ibm-cloud-private

Open the Vagrantfile and customize it for your machine’s capacity:

# Vagrantfile
...
# most laptops have at least 8 cores nowadays (adjust based
# on your laptop hardware)
cpus = '2'
 
# this will cause memory swapping in the VM
# performance is decent with SSD drives but may not be with
# spinning disks
#memory = '4096'
 
# use this setting for better performance if you have the ram
# available on your laptop
# uncomment the below line and comment out the above line
# "#memory = '4096'"
memory = '10240'
…

Now, just bring up the Vagrant VirtualBox machine. As it comes up, IBM Cloud Private will be configured using the Community Edition available on DockerHub:

vagrant up

Configuring the IBM Cloud Private Kubernetes Command-Line Interface

The kubectl command-line interface, which assists with authorization and other product-specific tasks, is available for download from the web console:

sudo curl -ko /usr/local/bin/bx-pr https://mycluster.icp:8443/
api/cli/icp-linux-amd64
sudo chmod u+x /usr/local/bin/bx-pr

To ensure that you have a compatible version of kubectl and Helm, you can also copy each binary out of the IBM Cloud Private inception container used to configure the cluster:

sudo docker cp $(docker ps -qa --latest --filter 
"label=org.label-schema.name=icp
    inception-amd64"):/usr/local/bin/kubectl 
    /usr/local/bin/kubectl

sudo docker cp $(docker ps -qa --latest --filter 
"label=org.label-schema.name=icp-inception-amd64"):
/usr/local/bin/helm 
/usr/local/bin/helm

To authorize your command-line environment to work with Kubernetes, use bx-pr to login and then configure kubectl and Helm:

bx-pr login -a https://mycluster.icp:8443/ 
-u admin --skip-ssl-validation
API endpoint: https://mycluster.icp:8443/
 
Password>
Authenticating...
OK
 
Select an account:
1. mycluster Account (id-mycluster-account)
Enter a number> 1
Targeted account mycluster Account (id-mycluster-account)
 
Configuring helm and kubectl...
Configuring kubectl: /Users/mdelder/.bluemix/plugins/icp
/clusters
/mycluster/kube-config
Property "clusters.mycluster" unset.
Property "users.mycluster-user" unset.
Property "contexts.mycluster-context" unset.
Cluster "mycluster" set.
User "mycluster-user" set.
Context "mycluster-context" created.
Switched to context "mycluster-context".
 
Cluster mycluster configured successfully.
 
Configuring helm: /Users/mdelder/.helm
Helm configured successfully
 
OK

Follow the prompts to enter your password and select your cluster. Confirm that you now have access by running a command with kubectl, such as the following:

kubectl get pods

IBM Cloud Kubernetes Service

We recommend referencing the IBM Cloud Kubernetes Service documentation for information on how to get the CLI installed and running quickly. You can find supporting documents at http://ibm.biz/iks-cli. After you’ve completed the configuration, you can quickly and easily get a Kubernetes configuration file using ibmcloud ks cluster-config <myclustername>.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.188.218.184