Monday, 9 April 2018

IBM Cloud Private - Tinkering with Helm Charts

As is probably apparent, I'm on a learning-curve with IBM Cloud Private (ICP), having installed it a number of times over the past six months.

So, whilst I'm fairly happy with the installation, whether standalone using Vagrant or multi-node using VMware, I'm still learning the actual use cases to which ICP can be put.

In the context of helping someone with a Helm Chart deployment issue, I ran through a couple of sample scenarios: -

Scenario One - Creating and deploying and testing a Helm chart that does ABSOLUTELY NOTHING

Create a Sample Helm Chart

helm create demoapp

Creating demoapp

Validate the new Helm Chart's format

helm lint --strict demoapp

==> Linting demoapp
[INFO] Chart.yaml: icon is recommended

1 chart(s) linted, no failures


Package the Chart

helm package demoapp ; ls -l demo*.tgz

Successfully packaged chart and saved it to: /home/hayd/demoapp-0.1.0.tgz
-rw-r--r-- 1 root root 2394 Apr  9 07:51 demoapp-0.1.0.tgz


Log into ICP via the IBM Cloud CLI

bx pr login -a https://mycluster.icp:8443 --skip-ssl-validation -c id-mycluster-account -u admin -p admin

API endpoint: https://mycluster.icp:8443
Authenticating...
OK

Targeted account: mycluster Account (id-mycluster-account)


Upload the new Chart

bx pr load-helm-chart --archive demoapp-0.1.0.tgz --clustername mycluster.icp

Loading helm chart
  {"url":"https://icp-management-ingress:8443/helm-repo/charts/index.yaml"}
OK

Synch charts
  {"message":"synch started"}
OK


Sync Helm Repositories

Via UI, Manage -> Helm Repositories -> Sync Repositories -> OK

Install Helm Chart

Via UI, Catalog -> Helm Charts -> [demoapp] -> Configure

I used this as source: -


for this.

I then went one step further, using this: -


which uses a Docker image ( Busybox ) instead.

Create Helm Chart

helm create helloworld-chart

Creating helloworld-chart

Update values.yaml for the Hello World Busybox example

vi helloworld-chart/values.yaml

Replace existing image and service tags: -

image:
  repository: nginx
  tag: stable
  pullPolicy: IfNotPresent
service:
  name: nginx
  type: ClusterIP
  externalPort: 80
  internalPort: 80

with: -

image:
  repository: reyesoft/hello-world
  tag: latest
  pullPolicy: IfNotPresent
service:
  name: hello-world
  type: LoadBalancer
  externalPort: 80
  internalPort: 8005


Validate the Helm Chart

helm lint --strict helloworld-chart

==> Linting helloworld-chart
[INFO] Chart.yaml: icon is recommended

1 chart(s) linted, no failures


Package the Chart

helm package helloworld-chart ; ls -l *.tgz

Successfully packaged chart and saved it to: /Users/davidhay/helloworld-chart-0.1.0.tgz
-rw-r--r--  1 davidhay  staff  2418  9 Apr 19:20 helloworld-chart-0.1.0.tgz


Log into ICP via the IBM Cloud CLI

bx pr login -a https://mycluster.icp:8443 --skip-ssl-validation -c id-mycluster-account -u admin -p admin

Upload the new Chart

bx pr load-helm-chart --archive helloworld-chart-0.1.0.tgz --clustername mycluster.icp

Sync Helm Repositories ( via UI, Manage -> Helm Repositories -> Sync Repositories -> OK )

Install Helm Chart ( via UI, Catalog -> Helm Charts -> demoapp -> Configure )

- I need to work out how to achieve the same via the CLI

Test Helm Chart

curl http://192.168.1.102:32302/

<h1>Hello world!</h1>

curl http://icpproxy.uk.ibm.com:32302/

<h1>Hello world!</h1>


No comments:

Note to self - use kubectl to query images in a pod or deployment

In both cases, we use JSON ... For a deployment, we can do this: - kubectl get deployment foobar --namespace snafu --output jsonpath="{...