{"id":823,"date":"2020-03-30T21:00:00","date_gmt":"2020-03-30T21:00:00","guid":{"rendered":"http:\/\/bullyrooks.com\/index.php\/2020\/04\/11\/simple-spring-boot-service-to-kubernetes-application-step-21-6986a29db37a\/"},"modified":"2021-02-04T02:18:09","modified_gmt":"2021-02-04T02:18:09","slug":"simple-spring-boot-service-to-kubernetes-application-step-21-6986a29db37a","status":"publish","type":"post","link":"https:\/\/bullyrooks.com\/index.php\/2020\/03\/30\/simple-spring-boot-service-to-kubernetes-application-step-21-6986a29db37a\/","title":{"rendered":"Simplify Deployment"},"content":{"rendered":"\n<p class=\"graf graf--p graf-after--h3 graf--trailing\" id=\"7c85\">Now that we have multiple components lets simplify our deployment so that we can deploy our complete application in one step.<\/p>\n\n\n\n<h3 class=\"graf graf--h3 graf--leading wp-block-heading\" id=\"a6e0\">Create an Umbrella&nbsp;Chart<\/h3>\n\n\n\n<p class=\"graf graf--p graf-after--h3\" id=\"853c\">Create a new git repository called <code class=\"markup--code markup--p-code\">medium-application<\/code>. This is the repository that will house the helm umbrella chart. Create a directory called <code class=\"markup--code markup--p-code\">helm <\/code>and run helm create <code class=\"markup--code markup--p-code\">medium-application<\/code> in that directory. Again, we\u2019re not going to need hardly any of this so lets remove any files that are unnecessary.<\/p>\n\n\n\n<p class=\"graf graf--p graf-after--p\" id=\"9982\">we only need a Chart.yaml<\/p>\n\n\n\n<pre id=\"25f7\" class=\"wp-block-code graf graf--pre graf-after--p\"><code>apiVersion: v1\nname: medium-application\ndescription: A Helm chart for Kubernetes\ntype: application\nversion: 0.1.0\nappVersion: 1.16.0\ndependencies:\n  - name: medium-customer\n    version: 11\n    repository: alias:codefresh\n  - name: medium-customer-manager\n    version: 6\n    repository: alias:codefresh\n  - name: medium-ingress\n    version: 1\n    repository: alias:codefresh<\/code><\/pre>\n\n\n\n<p class=\"graf graf--p graf-after--pre\" id=\"a4b5\">Lets go ahead and make a new pipeline to package and index this chart into our helm repo.<\/p>\n\n\n\n<pre id=\"d164\" class=\"wp-block-code graf graf--pre graf-after--p\"><code>version: \"1.0\"\nstages:\n  - \"clone\"\n  - \"helmpublish\"<\/code><\/pre>\n\n\n\n<pre id=\"2be3\" class=\"wp-block-code graf graf--pre graf-after--pre\"><code>steps:\n  Clone:\n    title: \"Cloning repository\"\n    type: \"git-clone\"\n    repo: \"<a class=\"markup--anchor markup--pre-anchor\" href=\"https:\/\/github.com\/brianrook\/medium-application\" target=\"_blank\" rel=\"nofollow noopener\" data-href=\"https:\/\/github.com\/brianrook\/medium-application\">https:\/\/github.com\/brianrook\/medium-application<\/a>\"\n    revision: \"master\"\n    stage: \"clone\"\n  HelmChartGetVersion:\n    title: Get Helm Chart Version\n    stage: helmpublish\n    image: codefresh\/cfstep-helm\n    working_directory: '\/codefresh\/volume\/medium-application'\n    environment:\n      - CHART_PATH=helm\/medium-application\n      - CHART_NAME=medium-application\n    commands:\n      - export ACTION=auth\n      - source \/opt\/bin\/release_chart\n      - helm repo add default ${{CF_CTX_CF_HELM_DEFAULT_URL}}\n      - yq .version ${CHART_PATH}\/Chart.yaml\n      - export CURRENT_CHART_VERSION=`helm search default\/${CHART_NAME} | awk 'FNR==2{print $2}' || yq .version ${CHART_PATH}\/Chart.yaml`\n      - echo $CURRENT_CHART_VERSION\n      - cf_export NEW_CHART_VERSION=`echo \"${CURRENT_CHART_VERSION}\" | awk -F. '{$NF = $NF + 1;} 1' | sed 's\/ \/.\/g'`\n      - echo $NEW_CHART_VERSION\n  HelmChartUpdate:\n    title: Update Helm Chart Version\n    stage: helmpublish\n    image: gksoftware\/yq\n    working_directory: '\/codefresh\/volume\/medium-application'\n    environment:\n      - CHART_PATH=helm\/medium-application\n      - YAML_PATH=image.tag\n    commands: \n      - echo $NEW_CHART_VERSION\n      - yq w -i ${CHART_PATH}\/Chart.yaml version ${NEW_CHART_VERSION}\n      - echo $CF_SHORT_REVISION\n      - yq w -i ${CHART_PATH}\/values.yaml ${YAML_PATH} '\"${{CF_SHORT_REVISION}}\"'\n  HelmChartPush:\n      title: Push Helm Chart to Chart Repository\n      stage: helmpublish\n      image: codefresh\/cfstep-helm\n      working_directory: '\/codefresh\/volume\/medium-application'\n      environment:\n        - CHART_REF=helm\/medium-application\/\n        - ACTION=push<\/code><\/pre>\n\n\n\n<p class=\"graf graf--p graf-after--pre\" id=\"80f7\">Make sure to change your trigger to kick off from a master commit. Also make sure to add the shared configuration for the helm registry so our pipeline can access it.<\/p>\n\n\n\n<h3 class=\"graf graf--h3 graf-after--p wp-block-heading\" id=\"a41b\">Commit and&nbsp;Build<\/h3>\n\n\n\n<pre id=\"b799\" class=\"wp-block-code graf graf--pre graf-after--h3\"><code>git checkout -b helm\ngit add .\ngit commit -m \"helm chart\"\ngit push\ngit checkout master\ngit merge helm\ngit push<\/code><\/pre>\n\n\n\n<p class=\"graf graf--p graf-after--pre\" id=\"601b\">Our pipeline should now detect that change and put our umbrella chart in the helm registry. Lets pull it down and try to deploy it.<\/p>\n\n\n\n<pre id=\"8540\" class=\"wp-block-code graf graf--pre graf-after--p\"><code>helm repo update\nhelm search repo codefresh\nhelm delete medium\nhelm install medium codefresh\/medium-application<\/code><\/pre>\n\n\n\n<p class=\"graf graf--p graf-after--pre\" id=\"b87d\">Hit your endpoint and you should see the deployed application at <code class=\"markup--code markup--p-code\"><a class=\"markup--anchor markup--p-anchor\" href=\"http:\/\/medium-example.com\/\" target=\"_blank\" rel=\"noopener\" data-href=\"http:\/\/medium-example.com\/\">http:\/\/medium-example.com\/<\/a><\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"entry-summary\">\nNow that we have multiple components lets simplify our deployment so that&hellip;\n<\/div>\n<div class=\"link-more\"><a href=\"https:\/\/bullyrooks.com\/index.php\/2020\/03\/30\/simple-spring-boot-service-to-kubernetes-application-step-21-6986a29db37a\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &ldquo;Simplify Deployment&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":[78,29,79,81,50,103],"course":[40],"class_list":["post-823","post","type-post","status-publish","format-standard","hentry","category-software-development","tag-automation","tag-git","tag-helm","tag-helm-chart","tag-maven","tag-umbrella-chart","course-spring-with-kubernetes","entry"],"jetpack_featured_media_url":"","jetpack-related-posts":[{"id":836,"url":"https:\/\/bullyrooks.com\/index.php\/2020\/03\/30\/simple-spring-boot-service-to-kubernetes-application-step-11-636b842a3c0f\/","url_meta":{"origin":823,"position":0},"title":"Helm for Deployment","author":"Bullyrook","date":"March 30, 2020","format":false,"excerpt":"We\u2019re about ready to deploy into kubernetes. However, deployment is not exactly straightforward. There are a lot of configuration files that we need to create and maintain in order to explain to the container management system how to deploy our application. We can use tools like kubectl to promote these\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":"","width":0,"height":0},"classes":[]},{"id":817,"url":"https:\/\/bullyrooks.com\/index.php\/2020\/03\/30\/simple-spring-boot-service-to-kubernetes-application-step-20-fe28a586cdc6\/","url_meta":{"origin":823,"position":1},"title":"Creating an Ingress in Kubernetes","author":"Bullyrook","date":"March 30, 2020","format":false,"excerpt":"We\u2019ve got multiple service available for deployment now. Lets allow them to communicate internally and externally with the cluster. We\u2019ll do that by creating an ingress. Current State of Our Application We\u2019re using our services as nodeports which allows us to expose an external port that will map to the\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":"","width":0,"height":0},"classes":[]},{"id":818,"url":"https:\/\/bullyrooks.com\/index.php\/2020\/03\/30\/simple-spring-boot-service-to-kubernetes-application-step-19-944a76415384\/","url_meta":{"origin":823,"position":2},"title":"Put the UI in to Helm","author":"Bullyrook","date":"March 30, 2020","format":false,"excerpt":"Lets take the docker image we just created and wrap it with helm so that we have an easy way to deploy our application. Create Helm Chart Templates We\u2019ve created helm charts before, so lets create a helm directory at the frontend root. Then run helm create in that directory\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":"","width":0,"height":0},"classes":[]},{"id":822,"url":"https:\/\/bullyrooks.com\/index.php\/2020\/03\/30\/simple-spring-boot-service-to-kubernetes-application-step-13-c3d437bb7570\/","url_meta":{"origin":823,"position":3},"title":"Automating Deployment (for CICD)","author":"Bullyrook","date":"March 30, 2020","format":false,"excerpt":"Now that we\u2019ve deployed our application, lets reduce some of the manual steps and make our deployments more reproducible with the intent of eventually making them automated for CI\/CD. Publish our Chart to the Chart Repository Normally, we would need to create a helm chart repository, however, codefresh has given\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":"","width":0,"height":0},"classes":[]},{"id":1176,"url":"https:\/\/bullyrooks.com\/index.php\/2022\/01\/04\/cloud-kube-helm-initialization-and-chart-publishing\/","url_meta":{"origin":823,"position":4},"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":1205,"url":"https:\/\/bullyrooks.com\/index.php\/2022\/01\/04\/kube-cloud-automate-kube-deploy\/","url_meta":{"origin":823,"position":5},"title":"Kube Cloud | Automate Kube Deploy","author":"Bullyrook","date":"January 4, 2022","format":false,"excerpt":"Lets improve our CD pipeline by automating deployment. Update Build Pipeline I only want main to deploy on successful build. So add these lines to the end of the main.yaml github action workflow - name: Deploy uses: WyriHaximus\/github-action-helm3@v2 with: exec: | helm repo add bullyrooks https:\/\/bullyrooks.github.io\/helm-charts\/ helm repo update helm\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-36.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/bullyrooks.com\/wp-content\/uploads\/2022\/01\/image-36.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/bullyrooks.com\/wp-content\/uploads\/2022\/01\/image-36.png?resize=700%2C400&ssl=1 2x"},"classes":[]}],"_links":{"self":[{"href":"https:\/\/bullyrooks.com\/index.php\/wp-json\/wp\/v2\/posts\/823","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=823"}],"version-history":[{"count":3,"href":"https:\/\/bullyrooks.com\/index.php\/wp-json\/wp\/v2\/posts\/823\/revisions"}],"predecessor-version":[{"id":917,"href":"https:\/\/bullyrooks.com\/index.php\/wp-json\/wp\/v2\/posts\/823\/revisions\/917"}],"wp:attachment":[{"href":"https:\/\/bullyrooks.com\/index.php\/wp-json\/wp\/v2\/media?parent=823"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bullyrooks.com\/index.php\/wp-json\/wp\/v2\/categories?post=823"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bullyrooks.com\/index.php\/wp-json\/wp\/v2\/tags?post=823"},{"taxonomy":"course","embeddable":true,"href":"https:\/\/bullyrooks.com\/index.php\/wp-json\/wp\/v2\/course?post=823"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}