save apiKey.json to C:\work\IBM Cloud
install IBM Container CLI for Mac OS:
https://console.bluemix.net/docs/cli/reference/bluemix_cli/all_versions.html#bluemix-cli-installer-all-versions?cm_mmc=IBMBluemixGarageMethod-_-MethodSite-_-10-19-15::12-31-18-_-bluemix-cli-install
others cna be refered to below URL:
https://console.bluemix.net/docs/cli/reference/bluemix_cli/all_versions.html?cm_mc_uid=35473498295515120160375&cm_mc_sid_50200000=73555711521689076112#bluemix-cli-installer-all-versions?cm_mmc=IBMBluemixGarageMethod-_-MethodSite-_-10-19-15::12-31-18-_-bluemix-cli-install
Install kubectl with latest version for Mac OS:
curl -LO https://storage.googleapis.com/kubernetes-release/release/`curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/darwin/amd64/kubectl
michael01s-Mac:ibmcloud michael01$ sudo mv ./kubectl /usr/local/bin/kubectl
michael01s-Mac:ibmcloud michael01$ kubectl version
Client Version: version.Info{Major:"1", Minor:"9", GitVersion:"v1.9.6", GitCommit:"9f8ebd171479bec0ada837d7ee641dec2f8c6dd1", GitTreeState:"clean", BuildDate:"2018-03-21T15:21:50Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"darwin/amd64"}
The connection to the server localhost:8080 was refused - did you specify the right host or port?
michael01s-Mac:ibmcloud michael01$
出现这个错误是因为没有设置Kubenetes的配置文件,当执行网命令“bx cs cluster-config cloudnativedev”后,会有一个export的设置环境变量,之后再执行kubectl version就没有错误了,例如:
michael01s-Mac:~ michael01$ kubectl version
Client Version: version.Info{Major:"1", Minor:"8", GitVersion:"v1.8.6", GitCommit:"6260bb08c46c31eea6cb538b34a9ceb3e406689c", GitTreeState:"clean", BuildDate:"2017-12-21T06:34:11Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"darwin/amd64"}
The connection to the server localhost:8080 was refused - did you specify the right host or port?
michael01s-Mac:~ michael01$
install Helm:
需要在Mac OS先安装 HomeBrew:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
需要先创建容器和集群,之后才能helm init
[root@localhost soft]# curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 64.4M 100 64.4M 0 0 8539k 0 0:00:07 0:00:07 --:--:-- 9.8M
[root@localhost soft]# chmod +x ./kubectl
[root@localhost soft]# sudo mv ./kubectl /usr/local/bin/kubectl
[root@localhost soft]# kubectl version
Client Version: version.Info{Major:"1", Minor:"9", GitVersion:"v1.9.6", GitCommit:"9f8ebd171479bec0ada837d7ee641dec2f8c6dd1", GitTreeState:"clean", BuildDate:"2018-03-21T15:21:50Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"linux/amd64"}
The connection to the server localhost:8080 was refused - did you specify the right host or port?
[root@localhost soft]# bx plugin install container-service -r Bluemix
Looking up 'container-service' from repository 'Bluemix'...
Plug-in 'container-service 0.1.481' found in repository 'Bluemix'
Plug-in 'container-service 0.1.481' was already installed. Do you want to re-install it or not? (yes/no)> yes
Attempting to download the binary file...
72.00 KiB / 20.21 MiB [>---------------------------------------] 0.35% 23m58s^C
[root@localhost soft]# bx login -a https://api.ng.bluemix.net
API endpoint: https://api.ng.bluemix.net
Email> [email protected]
Password>
Authenticating...
OK
Select an account (or press enter to skip):
1. Michael Zhang's Account (7cf696c84b0d30a37193435dd72c4b10)
Enter a number> 1
Targeted account Michael Zhang's Account (7cf696c84b0d30a37193435dd72c4b10)
Targeted resource group Development
API endpoint: https://api.ng.bluemix.net (API version: 2.92.0)
Region: us-south
User: [email protected]
Account: Michael Zhang's Account (7cf696c84b0d30a37193435dd72c4b10)
Resource group: Development
Org:
Space:
Tip: If you are managing Cloud Foundry applications and services
- Use 'bx target --cf' to target Cloud Foundry org/space interactively, or use 'bx target -o ORG -s SPACE' to target the org/space.
- Use 'bx cf' if you want to run the Cloud Foundry CLI with current Bluemix CLI context.
A new version of Bluemix CLI is available.
TIP: use 'bx config --check-version=false' to disable version check.
Do you want to update? (yes/no) [yes]> no
[root@localhost soft]# bx cs region-set us-south
Kubernetes version 1.5 is deprecated. To continue receiving important security updates and support, update your Kubernetes 1.5 clusters before April 4, 2018. Learn more at https://ibm.biz/BdZYns.
OK
[root@localhost soft]# bx cs cluster-config cloudnativedev
OK
The configuration for cloudnativedev was downloaded successfully. Export environment variables to start using Kubernetes.
export KUBECONFIG=/root/.bluemix/plugins/container-service/clusters/cloudnativedev/kube-config-hou02-cloudnativedev.yml
[root@localhost soft]# export KUBECONFIG=/root/.bluemix/plugins/container-service/clusters/cloudnativedev/kube-config-hou02-cloudnativedev.yml
[root@localhost soft]# helm init --upgrade
$HELM_HOME has been configured at /root/.helm.
Tiller (the Helm server-side component) has been installed into your Kubernetes Cluster.
Please note: by default, Tiller is deployed with an insecure 'allow unauthenticated users' policy.
For more information on securing your installation see: https://docs.helm.sh/using_helm/#securing-your-helm-installation
Happy Helming!
[root@localhost soft]# kubectl get nodes
NAME STATUS ROLES AGE VERSION
10.76.199.12 Ready
[root@localhost soft]# helm install --name bluecompute ibmcase/bluecompute-ce
NAME: bluecompute
LAST DEPLOYED: Thu Mar 22 15:54:03 2018
NAMESPACE: default
STATUS: DEPLOYED
RESOURCES:
==> v1/Service
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
bluecompute-auth ClusterIP 172.21.87.57
bluecompute-catalog ClusterIP 172.21.166.178
bluecompute-customer ClusterIP 172.21.157.150
bluecompute-customer-couchdb ClusterIP 172.21.28.12
bluecompute-catalog-elasticsearch ClusterIP 172.21.134.205
bluecompute-inventory-mysql ClusterIP 172.21.25.224
bluecompute-orders-mysql ClusterIP 172.21.218.175
bluecompute-inventory ClusterIP 172.21.198.143
bluecompute-orders ClusterIP 172.21.69.95
bluecompute-web NodePort 172.21.248.202
==> v1beta1/Deployment
NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
bluecompute-auth 1 1 1 0 3s
bluecompute-catalog 1 1 1 0 3s
bluecompute-customer 1 1 1 0 3s
bluecompute-customerdb-couchdb 1 1 1 0 3s
bluecompute-catalogdb-elasticsearch 1 1 1 0 3s
bluecompute-inventory-mysql 1 1 1 0 3s
bluecompute-orders-mysql 1 1 1 0 3s
bluecompute-inventory 1 1 1 0 3s
bluecompute-orders 1 1 1 0 3s
bluecompute-web 1 1 1 0 3s
==> v1/Job
NAME DESIRED SUCCESSFUL AGE
bluecompute-customer-create-user-dtocz 1 0 3s
bluecompute-inventory-populate-mysql-lhzzs 1 0 3s
==> v1beta1/Ingress
NAME HOSTS ADDRESS PORTS AGE
bluecompute-web * 80 3s
==> v1/Pod(related)
NAME READY STATUS RESTARTS AGE
bluecompute-auth-cc74c8b56-d5wkd 0/1 ContainerCreating 0 3s
bluecompute-catalog-54ccff6897-4qjsb 0/1 ContainerCreating 0 3s
bluecompute-customer-6855575fc7-7crlz 0/1 ContainerCreating 0 3s
bluecompute-customerdb-couchdb-7d96c8dd75-tbvpc 0/1 ContainerCreating 0 3s
bluecompute-catalogdb-elasticsearch-79cb959c4d-tqdzd 0/1 ContainerCreating 0 3s
bluecompute-inventory-mysql-67f895b4c5-75wnl 0/1 Init:0/1 0 3s
bluecompute-orders-mysql-b8668bc7c-qj9fk 0/1 Pending 0 3s
bluecompute-inventory-5984466ccb-sg6dq 0/1 Pending 0 3s
bluecompute-orders-69cd8cc5c8-s77n6 0/1 Pending 0 2s
bluecompute-web-84bc5f67d9-n76m8 0/1 Pending 0 2s
bluecompute-customer-create-user-dtocz-6v2jt 0/1 Pending 0 3s
bluecompute-inventory-populate-mysql-lhzzs-25c4w 0/1 Pending 0 3s
==> v1/Secret
NAME TYPE DATA AGE
binding-customer-couchdb Opaque 3 3s
binding-catalog-elasticsearch Opaque 1 3s
binding-inventorydb-mysql Opaque 4 3s
binding-ordersdb-mysql Opaque 4 3s
bluecompute-hs256-key Opaque 1 3s
bluecompute-bluecompute-hs256key Opaque 1 3s
==> v1/ConfigMap
NAME DATA AGE
bluecompute-web-config 2 3s
NOTES:
##########################################################
###### Bluecompute was successfully installed!!! #####
##########################################################
To view the Bluecompute Web Application in your browser please do the following, please follow the steps below:
1. To get the IP Address for the Web Application, run one the following commands based on your environment:
IBM Cloud Container Service:
nodeip=$(bx cs workers YOUR_CLUSTER_NAME | grep -v '^*' | egrep -v "(ID|OK)" | awk '{print $2;}' | head -n1)
IBM Cloud Private:
nodeip=PROXY_NODE_EXTERNAL_IP
Minikube:
nodeip=$(minikube ip)
Others:
nodeip=$(kubectl get nodes -o jsonpath='{.items[*].status.addresses[?(@.type=="ExternalIP")].address}' | awk '{print $1}')
2. To get the Web Port for the Web Application, run the following command:
port=$(kubectl --namespace default get service bluecompute-web -o jsonpath='{.spec.ports[0].nodePort}')
3. To get the entire URL for the Web Application, run the following command:
echo "http://${nodeip}:${port}"
4. Open a new web browser window and paste the URL above.
[root@localhost soft]# nodeip=$(bx cs workers cloudnativedev | grep -v '^*' | egrep -v "(ID|OK)" | awk '{print $2;}' | head -n1)
[root@localhost soft]# port=$(kubectl --namespace default get service bluecompute-web -o jsonpath='{.spec.ports[0].nodePort}')
[root@localhost soft]# echo "http://${nodeip}:${port}"
http://184.173.5.57:31337