{"id":1205,"date":"2022-01-04T19:57:27","date_gmt":"2022-01-05T02:57:27","guid":{"rendered":"https:\/\/bullyrooks.com\/?p=1205"},"modified":"2022-01-04T19:57:27","modified_gmt":"2022-01-05T02:57:27","slug":"kube-cloud-automate-kube-deploy","status":"publish","type":"post","link":"https:\/\/bullyrooks.com\/index.php\/2022\/01\/04\/kube-cloud-automate-kube-deploy\/","title":{"rendered":"Kube Cloud | Automate Kube Deploy"},"content":{"rendered":"\n<p>Lets improve our CD pipeline by automating deployment.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Update Build Pipeline<\/h2>\n\n\n\n<p>I only want main to deploy on successful build.  So add these lines to the end of the main.yaml github action workflow<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>      - name: Deploy\n        uses: WyriHaximus\/github-action-helm3@v2\n        with:\n          exec: |\n            helm repo add bullyrooks https:\/\/bullyrooks.github.io\/helm-charts\/\n            helm repo update\n            helm upgrade cloud-application bullyrooks\/cloud-application --install --atomic\n          kubeconfig: '${{ secrets.KUBECONFIG }}'<\/code><\/pre>\n\n\n\n<p>This is going to execute the same things we just did manually<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Add the chart repository<\/li><li>Update it<\/li><li>Upgrade the cloud instance if it exists, otherwise install (<code>--install<\/code>) and rollback if it fails (<code>--atomic<\/code>).<\/li><\/ul>\n\n\n\n<p>You can see that we need to add a secret so lets do that.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Add the Okteto Kube Config<\/h2>\n\n\n\n<p>Navigate to the github repository settings\/secrets section<\/p>\n\n\n\n<p>Create a new secret called <code>KUBECONFIG<\/code> paste the entire contents of the <code>okteto-kube.config<\/code> file in as the value.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Redeploy and Verify<\/h2>\n\n\n\n<p>Push your changes up to main<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ git add .\n\n$ git commit -m \"automated deployment\"\nWriting objects: 100% (5\/5), 623 bytes | 623.00 KiB\/s, done.\nTotal 5 (delta 2), reused 0 (delta 0), pack-reused 0\nremote: Resolving deltas: 100% (2\/2), completed with 2 local objects.\nTo github.com-bullyrook:bullyrooks\/cloud_application.git\n   9f9185a..aa3d54b  main -&gt; main\n\n$ git push\n<\/code><\/pre>\n\n\n\n<p>Now navigate back to your github actions tab.  Confirm that the build kicked off.<\/p>\n\n\n\n<p>Under <code>Publish Helm Chart<\/code> you should see a new version got created<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Successfully packaged chart and saved it to: \/tmp\/tmp.bkbDop\/cloud-application-1.0.16.tgz<\/code><\/pre>\n\n\n\n<p>Under Deploy you should see that it deployed<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Release \"cloud-application\" has been upgraded. Happy Helming!\nNAME: cloud-application\nLAST DEPLOYED: Wed Jan  5 00:27:43 2022\nNAMESPACE: ***\nSTATUS: deployed\nREVISION: 3\nNOTES:\n1. Get the application URL by running these commands:\n  export NODE_PORT=$(kubectl get --namespace *** -o jsonpath=\"{.spec.ports&#91;0].nodePort}\" services cloud-application)\n  export NODE_IP=$(kubectl get nodes --namespace *** -o jsonpath=\"{.items&#91;0].status.addresses&#91;0].address}\")\n  echo http:\/\/$NODE_IP:$NODE_PORT<\/code><\/pre>\n\n\n\n<p>Now navigate to okteto and expand the deployment, check the yaml to see if the new version was deployed<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"904\" height=\"537\" src=\"https:\/\/i0.wp.com\/bullyrooks.com\/wp-content\/uploads\/2022\/01\/image-36.png?resize=904%2C537&#038;ssl=1\" alt=\"\" class=\"wp-image-1206\" srcset=\"https:\/\/i0.wp.com\/bullyrooks.com\/wp-content\/uploads\/2022\/01\/image-36.png?w=904&amp;ssl=1 904w, https:\/\/i0.wp.com\/bullyrooks.com\/wp-content\/uploads\/2022\/01\/image-36.png?resize=300%2C178&amp;ssl=1 300w, https:\/\/i0.wp.com\/bullyrooks.com\/wp-content\/uploads\/2022\/01\/image-36.png?resize=768%2C456&amp;ssl=1 768w\" sizes=\"auto, (max-width: 904px) 100vw, 904px\" data-recalc-dims=\"1\" \/><\/figure>\n\n\n\n<p>And double check in postman<\/p>\n\n\n\n<p>There you go!  Now any changes made into a feature branch will build and test.  When you have confidence it can release you can merge to main and it will get deployed into your cloud hosted environment. <\/p>\n\n\n\n<p>This make updating your application much easier.  However, it can be made much easier with tools like <a href=\"https:\/\/skaffold.dev\/\">skaffold <\/a>that hook into your IDE and build and push changes automatically after code changes.<\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"entry-summary\">\nLets improve our CD pipeline by automating deployment. Update Build Pipeline I&hellip;\n<\/div>\n<div class=\"link-more\"><a href=\"https:\/\/bullyrooks.com\/index.php\/2022\/01\/04\/kube-cloud-automate-kube-deploy\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &ldquo;Kube Cloud | Automate Kube Deploy&rdquo;<\/span>&hellip;<\/a><\/div>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[41],"tags":[147,79,80],"course":[149],"class_list":["post-1205","post","type-post","status-publish","format-standard","hentry","category-software-development","tag-github-actions","tag-helm","tag-kubernetes","course-kubernetes-application-hosted-in-the-cloud","entry"],"jetpack_featured_media_url":"","jetpack-related-posts":[{"id":1188,"url":"https:\/\/bullyrooks.com\/index.php\/2022\/01\/04\/cloud-kube-setup-cloud-hosting\/","url_meta":{"origin":1205,"position":0},"title":"Cloud Kube | Setup Cloud Hosting","author":"Bullyrook","date":"January 4, 2022","format":false,"excerpt":"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\u2026","rel":"","context":"In &quot;Software Development&quot;","block_context":{"text":"Software Development","link":"https:\/\/bullyrooks.com\/index.php\/category\/software-development\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/bullyrooks.com\/wp-content\/uploads\/2022\/01\/image-31.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/bullyrooks.com\/wp-content\/uploads\/2022\/01\/image-31.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/bullyrooks.com\/wp-content\/uploads\/2022\/01\/image-31.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":1377,"url":"https:\/\/bullyrooks.com\/index.php\/2022\/03\/08\/kube-cloud-pt6-consumer-contract-tests-for-rest-endpoints\/","url_meta":{"origin":1205,"position":1},"title":"Kube Cloud Pt6 | Consumer Contract Tests for REST Endpoints","author":"Bullyrook","date":"March 8, 2022","format":false,"excerpt":"Let's start with cloud-application, create a new branch git checkout -b client-contract Lets add the necessary dependencies to our pom.xml <pact.version>4.0.10<\/pact.version> <pact.provider.maven.plugin>4.3.5<\/pact.provider.maven.plugin> <\/properties> ... <!-- Contract Testing --> <dependency> <groupId>au.com.dius<\/groupId> <artifactId>pact-jvm-consumer-junit5<\/artifactId> <version>${pact.version}<\/version> <scope>test<\/scope> <\/dependency> ... <plugin> <groupId>au.com.dius.pact.provider<\/groupId> <artifactId>maven<\/artifactId> <version${pact.provider.maven.plugin}<\/version> <configuration> <pactBrokerUrl>${env.PACTFLOW_URL}<\/pactBrokerUrl> <pactBrokerToken>${env.PACTFLOW_TOKEN}<\/pactBrokerToken> <projectVersion>${env.PACT_PUBLISH_CONSUMER_VERSION}<\/projectVersion> <pactBrokerAuthenticationScheme>Bearer<\/pactBrokerAuthenticationScheme> <\/configuration> <\/plugin> Pact is mostly a\u2026","rel":"","context":"In &quot;Software Development&quot;","block_context":{"text":"Software Development","link":"https:\/\/bullyrooks.com\/index.php\/category\/software-development\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/bullyrooks.com\/wp-content\/uploads\/2022\/03\/Screen-Shot-2022-03-02-at-2.04.53-PM.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/bullyrooks.com\/wp-content\/uploads\/2022\/03\/Screen-Shot-2022-03-02-at-2.04.53-PM.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/bullyrooks.com\/wp-content\/uploads\/2022\/03\/Screen-Shot-2022-03-02-at-2.04.53-PM.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/bullyrooks.com\/wp-content\/uploads\/2022\/03\/Screen-Shot-2022-03-02-at-2.04.53-PM.png?resize=1050%2C600&ssl=1 3x, https:\/\/i0.wp.com\/bullyrooks.com\/wp-content\/uploads\/2022\/03\/Screen-Shot-2022-03-02-at-2.04.53-PM.png?resize=1400%2C800&ssl=1 4x"},"classes":[]},{"id":1176,"url":"https:\/\/bullyrooks.com\/index.php\/2022\/01\/04\/cloud-kube-helm-initialization-and-chart-publishing\/","url_meta":{"origin":1205,"position":2},"title":"Cloud Kube | Helm Initialization and Chart Publishing","author":"Bullyrook","date":"January 4, 2022","format":false,"excerpt":"Now that we're producing versioned docker images into our registry lets get helm setup and publish versioned charts. This will allow us to deploy fully configured services into kubernetes. Helm Init I'm assuming that helm is already installed in your development environment, so I'm not going to cover installing it.\u2026","rel":"","context":"In &quot;Software Development&quot;","block_context":{"text":"Software Development","link":"https:\/\/bullyrooks.com\/index.php\/category\/software-development\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/bullyrooks.com\/wp-content\/uploads\/2022\/01\/image-25.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/bullyrooks.com\/wp-content\/uploads\/2022\/01\/image-25.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/bullyrooks.com\/wp-content\/uploads\/2022\/01\/image-25.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":1264,"url":"https:\/\/bullyrooks.com\/index.php\/2022\/02\/13\/kube-cloud-pt3-health-indicators\/","url_meta":{"origin":1205,"position":3},"title":"Kube Cloud Pt3 | Health Indicators","author":"Bullyrook","date":"February 13, 2022","format":false,"excerpt":"Spring offers a way to tell if your services and their dependent resources are up and healthy. Kubernetes can leverage this functionality via their liveness and readiness probes to report if pods are available to service requests. In this session, we're going to enable and connect those health checks. Enable\u2026","rel":"","context":"In &quot;Software Development&quot;","block_context":{"text":"Software Development","link":"https:\/\/bullyrooks.com\/index.php\/category\/software-development\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/bullyrooks.com\/wp-content\/uploads\/2022\/02\/image-4.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/bullyrooks.com\/wp-content\/uploads\/2022\/02\/image-4.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/bullyrooks.com\/wp-content\/uploads\/2022\/02\/image-4.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":1296,"url":"https:\/\/bullyrooks.com\/index.php\/2022\/02\/19\/kube-cloud-pt4-tracing\/","url_meta":{"origin":1205,"position":4},"title":"Kube Cloud Pt4 | Tracing","author":"Bullyrook","date":"February 19, 2022","format":false,"excerpt":"For this portion we're going to use OpenTelemetry for tracing. OpenTelemetry projects intent is to solve all of the observability space in an opensource way. Unfortunately, at this time the logging and metrics portions are still in development, so we won't be able to use them. However the tracing piece\u2026","rel":"","context":"In &quot;General&quot;","block_context":{"text":"General","link":"https:\/\/bullyrooks.com\/index.php\/category\/general\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/bullyrooks.com\/wp-content\/uploads\/2022\/02\/image-35.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/bullyrooks.com\/wp-content\/uploads\/2022\/02\/image-35.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/bullyrooks.com\/wp-content\/uploads\/2022\/02\/image-35.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/bullyrooks.com\/wp-content\/uploads\/2022\/02\/image-35.png?resize=1050%2C600&ssl=1 3x, https:\/\/i0.wp.com\/bullyrooks.com\/wp-content\/uploads\/2022\/02\/image-35.png?resize=1400%2C800&ssl=1 4x"},"classes":[]},{"id":1230,"url":"https:\/\/bullyrooks.com\/index.php\/2022\/01\/23\/kube-cloud-pt2-database-configuration-in-kubernetes\/","url_meta":{"origin":1205,"position":5},"title":"Kube Cloud Pt2 | Database Configuration in Kubernetes","author":"Bullyrook","date":"January 23, 2022","format":false,"excerpt":"We now have an application that will connect to our MongoDB locally, but we'll need to tell it how to connect when its deployed to Okteto. Create Kubernetes Configuration First, create a secret in okteto with the database details. Run this command on your terminal. The uri should look like\u2026","rel":"","context":"In &quot;Software Development&quot;","block_context":{"text":"Software Development","link":"https:\/\/bullyrooks.com\/index.php\/category\/software-development\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/bullyrooks.com\/wp-content\/uploads\/2022\/01\/image-43.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/bullyrooks.com\/wp-content\/uploads\/2022\/01\/image-43.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/bullyrooks.com\/wp-content\/uploads\/2022\/01\/image-43.png?resize=700%2C400&ssl=1 2x"},"classes":[]}],"_links":{"self":[{"href":"https:\/\/bullyrooks.com\/index.php\/wp-json\/wp\/v2\/posts\/1205","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bullyrooks.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bullyrooks.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bullyrooks.com\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/bullyrooks.com\/index.php\/wp-json\/wp\/v2\/comments?post=1205"}],"version-history":[{"count":3,"href":"https:\/\/bullyrooks.com\/index.php\/wp-json\/wp\/v2\/posts\/1205\/revisions"}],"predecessor-version":[{"id":1211,"href":"https:\/\/bullyrooks.com\/index.php\/wp-json\/wp\/v2\/posts\/1205\/revisions\/1211"}],"wp:attachment":[{"href":"https:\/\/bullyrooks.com\/index.php\/wp-json\/wp\/v2\/media?parent=1205"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bullyrooks.com\/index.php\/wp-json\/wp\/v2\/categories?post=1205"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bullyrooks.com\/index.php\/wp-json\/wp\/v2\/tags?post=1205"},{"taxonomy":"course","embeddable":true,"href":"https:\/\/bullyrooks.com\/index.php\/wp-json\/wp\/v2\/course?post=1205"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}