We are planning to deploy applications to kubernetes via octopus deploy
We have tried using deploy kubernetes container step in octopus deploy .
But we don’t want to edit the yaml files directly there. Instead we want to store this yaml files in a filesystem and fetch it and deploy it .
Kindly suggest us on this.
We have tried with step deploy Raw kuberentes yaml step during process in project. We have tried with octopus built in option and had to mention the package.and upload package. Instead if there’s any option to mention path where our yaml files are stored on octopus deploy server .
There are a few options you can use to achieve this. Unfortunately, the built-in Kubernetes steps like “Deploy a Kubernetes Container” and “Deploy raw Kubernetes YAML” require you to either have the yaml in the in-line source code or pulled from a package.
Depending on how you operate, if you check your YAML files into GitHub, you could use the GitHub Feed option to pull the YAML files (assuming the correct tags are used).
The other option would be to use the “Run a Kubectl CLI script” step, where you can script out your Kubernetes deployment yourself and use a project variable to store the path to the YAML file, allowing you to store the files using a local file-store, like below:
Kindly request you to explain on this step to use the “Run a Kubectl CLI script” step
Where can we add our YAML file and their relative path /location .If we have our YAML files in one servers location, then how can we add that path .Please suggest
If you’re running Kubernetes on the Octopus Server then at the moment you can use a project variable to store the file-path of the YAML files on the Octopus Server.
Inside your project, go to Variables → Project:
Then, create a variable with a memorable name and set the value to the file path for your Kubernetes YAML file.
You can then use the “Insert a Variable” button to place this variable directly into the Inline Source Code of the 'Deploy a Kubectl CLI script" step, which Octopus will then use at deployment.
When you come to use workers to run Kubernetes, you would likely have to either have the YAMLs stored on the workers and use the file-path to the files as the variable value or you would need to provide your workers with access to a file share and use the file share path as the variable value.
I hope this helps, let me know if you have any further questions.
The best practice would likely be to store your YAML file inside a package and then store the package either in an external feed (GitHub) or in the Octopus Built-In feed.
This way you could use the “Deploy raw Kubernetes YAML” step to deploy the Kubernetes containers.
You can push packages to the built-in feed via command line or the user interface, our docs explain this better than I can, which you can view here: Built-In Octopus Repository.
If you update your YAML by updating the package and pushing a new package version to the built-in feed or an external feed, when you next create a release you can configure the release to use the latest version of the package, allowing you to dynamically update YAML configuration without having to edit the project process.
As your end goal is deploying to EKS, this blog post about configuring an EKS cluster inside Octopus may be useful to read: Creating an EKS cluster with eksctl.
we have tried this Octopus built in feed and used “Deploy raw Kubernetes YAML” step to deploy kubernetes containers. But every time we need to upload the package right ? and what if we need to have backup of that package ?
In our case we do not want to use external feeds like Github