Kubernetes Application Hosted in the Cloud
full course- Kubernetes Application Hosted in the Cloud
- Cloud Kube | Create Github Repo
- Cloud Kube | Simple REST Endpoint and Test
- Cloud Kube | Build Pipeline Initialization
- Cloud Kube | Docker Build and Registry
- Cloud Kube | Helm Initialization and Chart Publishing
- Cloud Kube | Setup Cloud Hosting
- Kube Cloud | Automate Kube Deploy
We’ve got a helm chart and associated docker image. Now we’re going to setup a cloud kubernetes provider to deploy our application to. Okteto offers a very generous kubernetes hosting platform that’s free for small developer projects.
Setup Okteto
First register on okteto by creating an account via your github account.
Now we need to connect to this kubernetes environment via command line. You should already have kubectl installed. Otherwise, you can find instructions on how to do that. The Okteto quickstart link is a good resource.
I use kubectl, so I import the okteto kube config into my environment. The instructions are here.
Now that we’ve got kubectl configured, we’ll need to setup our regcred so that okteto can access our images in canister.io.
$ kubectl create secret --namespace bullyrooks docker-registry regcred --docker-server=https://cloud.canister.io:5000 --docker-username=${your_username} --docker-password=${your_password} --docker-email=${your_email}
secret/regcred created
Now we can manually deploy into okteto via helm on the command line.
Deploy Manually with Helm
First add your chart repo to your local helm
$ helm repo add bullyrooks https://bullyrooks.github.io/helm-charts/
"bullyrooks" has been added to your repositories
Now update the repo
$ helm repo update
Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "bullyrooks" chart repository
...
Update Complete. ⎈Happy Helming!⎈
now double check your repo
$ helm search repo bullyrooks
NAME CHART VERSION APP VERSION DESCRIPTION
bullyrooks/cloud-application 1.0.3 1.0.3 A Helm chart for Kubernetes
now deploy it
$ helm install cloud-application bullyrooks/cloud-application
NAME: cloud-application
LAST DEPLOYED: Mon Jan 3 17:12:09 2022
NAMESPACE: brianrook
STATUS: deployed
REVISION: 1
NOTES:
1. Get the application URL by running these commands:
export NODE_PORT=$(kubectl get --namespace brianrook -o jsonpath="{.spec.ports[0].nodePort}" services cloud-application)
export NODE_IP=$(kubectl get nodes --namespace brianrook -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
You should see your service deployed in okteto
Grab the url from the endpoints section and copy that into postman to confirm you can access it
anytime that we make an update into the main branch now, we should be getting an updated chart pushed to our repository. We can deploy that into okteto with the following commands:
$ helm repo update
Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "bullyrooks" chart repository
Update Complete. ⎈Happy Helming!⎈
$ helm upgrade cloud-application bullyrooks/cloud-application
Release "cloud-application" has been upgraded. Happy Helming!
NAME: cloud-application
LAST DEPLOYED: Tue Jan 4 16:55:18 2022
NAMESPACE: bullyrooks
STATUS: deployed
REVISION: 2
NOTES:
1. Get the application URL by running these commands:
export NODE_PORT=$(kubectl get --namespace bullyrooks -o jsonpath="{.spec.ports[0].nodePort}" services cloud-application)
export NODE_IP=$(kubectl get nodes --namespace bullyrooks -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
0 comments on “Cloud Kube | Setup Cloud Hosting”Add yours →