diff --git a/.github/workflows/iks.yml b/.github/workflows/iks.yml index 06a8ffa..94f667e 100644 --- a/.github/workflows/iks.yml +++ b/.github/workflows/iks.yml @@ -18,7 +18,7 @@ env: ICR_NAMESPACE: ${{ secrets.ICR_NAMESPACE }} REGISTRY_HOSTNAME: us.icr.io IMAGE_NAME: hello-python - IKS_CLUSTER: bq1sm2gd0sjtps7ajoa0 # name or id of cluster + IKS_CLUSTER: ${{ secrets.IKS_CLUSTER_ID }} # create secrets for cluster id or name DEPLOYMENT_NAME: hello-python PORT: 5001 @@ -43,7 +43,7 @@ jobs: # Authenticate with IBM Cloud CLI - name: Authenticate with IBM Cloud CLI run: | - ibmcloud login --apikey "${IBM_CLOUD_API_KEY}" -r "${IBM_CLOUD_REGION}" -g default + ibmcloud login --apikey "${IBM_CLOUD_API_KEY}" -r "${IBM_CLOUD_REGION}" -g Default ibmcloud cr region-set "${IBM_CLOUD_REGION}" ibmcloud cr login @@ -70,3 +70,6 @@ jobs: kubectl create service loadbalancer $DEPLOYMENT_NAME --tcp=80:$PORT --dry-run -o yaml > service.yaml kubectl apply -f service.yaml kubectl get services -o wide + # also you can do that on nodeport service if you have free cluster setup + # kubectl expose deployment $DEPLOYMENT_NAME --type=NodePort --name=$DEPLOYMENT_NAME --port=31558 --target-port=$PORT --selector=app=$DEPLOYMENT_NAME --dry-run=client -o yaml > nodeport-service.yaml + # kubectl apply -f nodeport-service.yaml diff --git a/README.md b/README.md index 384cad4..617a4ef 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ This repo contains a sample GitHub Action for deploying an application to IBM Ku 1. If you'd like to use the file yourself fork the repo and open [.github/workflows/iks.yml](.github/workflows/iks.yml), you'll need to update a few environment variables. 1. Add your own IKS cluster name, image name, and deployment name. -1. In your GitHub repository settings create two secrets, `ICR_NAMESPACE` and `IBM_CLOUD_API_KEY`. +1. In your GitHub repository settings create three secrets, `ICR_NAMESPACE` , `IBM_CLOUD_API_KEY` and `IKS_CLUSTER_ID`. Get a new IBM Cloud API key from the [IAM settings](https://cloud.ibm.com/iam/apikeys).