Skip to content

Taiwrash/kubeaction

main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Using this made easy

Prerequisites:

  • Make sure you have Go installed on your local machine.
  • Install kubectl and configure it to connect to your Kubernetes cluster.

Step 1: Clone the Repository

  1. Clone the repository containing your Go application and the deployment files.

Step 2: Configure Kubernetes Manifests

  1. Navigate to the repository's root directory.
  2. Open the kubernetes directory.
  3. Modify the Kubernetes manifests (test.yaml, stage.yaml, production.yaml) according to your application's requirements. Update the image name, ports, environment variables, and other necessary configurations.
  4. Save the changes to the Kubernetes manifest files.

Step 3: Configure Deployment Scripts

  1. Open the repository's root directory.
  2. Create the deployment scripts for each environment by following the examples provided earlier (deploy_dev_test.sh, deploy_dev_stage.sh, deploy_staging_test.sh, deploy_staging_prod.sh, deploy_prod.sh).
  3. Customize the deployment scripts to match your deployment requirements. Update the paths to the Kubernetes manifest files in each script.

Step 4: Adjust the Go Deployment Logic

  1. Open the main.go file in your Go application's root directory.
  2. Update the deployment logic in the deployToDevelopment, deployToStaging, and deployToProduction functions to match your application's specific deployment steps for each environment and target.
  3. Save the changes to the main.go file.

Step 5: Set Up GitHub Actions Workflow

  1. Create a new file named .github/workflows/main.yml in the root directory of your repository.
  2. Copy the content of the provided GitHub Actions workflow into ci_cd.yml.
  3. Commit and push the changes to your repository.

Step 6: Trigger the CI/CD Workflow

  1. Push your changes to the repository's main branch.
  2. GitHub Actions will automatically trigger the CI/CD workflow defined in the ci_cd.yml file.
  3. The workflow will build and test your Go application and then deploy it to the specified environments: test, stage, and production.

Step 7: Verify the Deployments

  1. Access your Kubernetes cluster and verify that the application has been deployed to the test, stage, and production environments.
  2. Ensure that the deployments and pods are running successfully.

That's it! You've successfully set up the solution to deploy your Go application to multiple environments in a Kubernetes cluster using GitHub Actions and the provided deployment scripts.

You can further customize the deployment scripts, Kubernetes manifests, and Go deployment logic to match your specific application requirements and deployment process.

Remember to keep your deployment scripts and Kubernetes manifests up to date as your application evolves or new versions are released.

Feel free to reach out if you have any further questions or need additional assistance!

About

A GitHub Actions to deploy orchestrated containers to test, staging and production environment

Resources

License

Stars

Watchers

Forks

Packages

No packages published