Skip to content

Commit 0a4c91a

Browse files
authored
Merge pull request #108 from kbst/addstarterreadmes
Add README.md files to starter repositories
2 parents bbcb0e4 + 18046ed commit 0a4c91a

File tree

6 files changed

+140
-0
lines changed

6 files changed

+140
-0
lines changed
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
# Welcome to Kubestack
2+
3+
This repository uses [Kubestack][1]. Kubestack is the open source GitOps framework for teams that want to automate infrastructure, not reinvent automation.
4+
5+
* Infrastructure is defined using Terraform configuration
6+
* Cluster manifests are defined using Kustomize bases and overlays
7+
* Bases and overlays can be bespoke, or consumed from the [catalog][2].
8+
* Both infrastructure and manifests follow the Kubestack [inheritance model][3] to prevent configuration drift between the *ops* and *apps* environments
9+
* All changes follow the same four step process.
10+
11+
Full [framework documentation][4] is available online.
12+
13+
## Making changes
14+
15+
All changes to the Kubernetes cluster, supporting infrastructure and the services defined as part of the manifests in this repository follow the Kubestack [GitOps process][5]. The GitOps process ensures that changes are safely applied by first reviewing the proposed changes, then validating the changes against the *ops* environment and only then promoting the changes to be applied against the *apps* environment by setting a tag.
16+
17+
To accelerate the developer workflow, a [development environment][6], can be run on localhost.
18+
19+
1. Change
20+
21+
Make changes to the configuration in a new branch. Commit the changed configuration. Validate your changes by pushing the new branch. The pipeline runs `terraform plan` against the *ops* workspace.
22+
23+
```shell
24+
# checkout a new branch from master
25+
git checkout -b examplechange master
26+
27+
# make your changes
28+
29+
# commit your changes
30+
git commit # write a meaningful commit message
31+
32+
# push your changes
33+
git push origin examplechange
34+
```
35+
36+
1. Review
37+
38+
Request a peer review of your changes. Team members review the changes and the Terraform plan. If reviewers require changes, make additional commits in the branch.
39+
40+
```shell
41+
# make sure you're in the correct branch
42+
git checkout examplechange
43+
44+
# make changes required by the review
45+
46+
# commit and push the required changes
47+
git commit # write a meaningful commit message
48+
git push origin examplechange
49+
```
50+
51+
1. Merge
52+
53+
If approved, merge your changes to master, to apply them against the *ops* environment. After applying to *ops* was successful, the pipeline runs Terraform plan against the *apps* environment.
54+
55+
```shell
56+
# you can merge on the commandline
57+
# or by merging a pull request
58+
git checkout master
59+
git merge examplechange
60+
git push origin master
61+
```
62+
63+
1. Promote
64+
65+
Review the previous *apps* environment plan and tag the merge commit to promote the same changes to the *apps* environment.
66+
67+
```shell
68+
# make sure you're on the correct commit
69+
git checkout master
70+
git pull
71+
git log -1
72+
73+
# if correct, tag the current commit
74+
# any tag prefixed with `apps-deploy-`
75+
# will trigger the pipeline
76+
git tag apps-deploy-$(date -I)-0
77+
78+
# in case of multiple deploys on the same day,
79+
# increase the counter
80+
# e.g. git tag apps-deploy-2020-05-14-1
81+
```
82+
83+
## Manual operations
84+
85+
In case of the automation being unavailable, upgrades requiring manual steps or in disaster recovery scenarios run Terraform and the cloud CLI locally. Kubestack provides container images bundling all dependencies to use for both automated and manual operations.
86+
87+
```shell
88+
# Build the bootstrap container
89+
docker build -t kubestack .
90+
91+
# Exec into the bootstrap container
92+
docker run --rm -ti \
93+
-v `pwd`:/infra \
94+
# uncomment to mount the docker socket for local dev
95+
# -v /var/run/docker.sock:/var/run/docker.sock \
96+
kubestack
97+
```
98+
99+
```shell
100+
# if you haven't before, login
101+
102+
# for AWS
103+
aws configure
104+
105+
# for Azure
106+
az login
107+
108+
# for GCP
109+
gcloud init
110+
gcloud auth application-default login
111+
```
112+
113+
```shell
114+
# select the desired environment
115+
# for ops
116+
terraform workspace select ops
117+
118+
# or for apps
119+
terraform workspace select apps
120+
```
121+
122+
```shell
123+
# run terraform init
124+
terraform init
125+
126+
# run terraform commands as required, e.g.
127+
terraform plan
128+
```
129+
130+
[1]: https://www.kubestack.com
131+
[2]: https://www.kubestack.com/catalog
132+
[3]: https://www.kubestack.com/framework/documentation/inheritance-model
133+
[4]: https://www.kubestack.com/framework/documentation
134+
[5]: https://www.kubestack.com/framework/documentation/gitops-process
135+
[6]: https://www.kubestack.com/framework/documentation/tutorial-build-local-lab
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../_shared/README.md
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../_shared/README.md
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../_shared/README.md
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../_shared/README.md
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../_shared/README.md

0 commit comments

Comments
 (0)