-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ed5de76
commit 204e70b
Showing
7 changed files
with
210 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,7 +34,14 @@ jobs: | |
uses: gittools/actions/gitversion/[email protected] | ||
with: | ||
additionalArguments: /overrideconfig mode=Mainline | ||
- name: Login to Docker Hub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_SAMPLES_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_SAMPLES_PASSWORD }} | ||
- name: build and push website container | ||
working-directory: src | ||
run: | | ||
docker build -f "./RandomQuotes.Web/Dockerfile" --tag randomquotes-k8s:${{ steps.determine_version.outputs.semVer }} --tag randomquotes-k8s:latest . | ||
docker build -f "./RandomQuotes.Web/Dockerfile" --tag octopussamples/randomquotes-k8s:${{ steps.determine_version.outputs.semVer }} --tag octopussamples/randomquotes-k8s:latest . | ||
docker push octopussamples/randomquotes-k8s:${{ steps.ReleaseNum.outputs.APP_VERSION }} | ||
docker push octopussamples/randomquotes-k8s:latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
This is a sample application deploy to Kubernetes. It's a good first application as it has no other components, but has an environment variable you can use to practice secrets on. | ||
|
||
# Prep Work | ||
|
||
- Install minikube, rancher desktop, or docker desktop locally. | ||
- Open up a command prompt or terminal. Change the current directory to `k8s/provision` folder in this repo. | ||
- Run the following commands: | ||
- Create all the namespaces: `kubectl apply -f namespaces.yaml` | ||
- Create the service account for deployments: `kubectl apply -f service-account-and-token.yaml` | ||
- To get the token value run: `kubectl describe secret octopus-svc-account-token`. Copy the token to a file for future usage. | ||
- Install the NGINX Ingress Controller: `kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.9.5/deploy/static/provider/cloud/deploy.yaml` | ||
- Go to your hosts file (if on Windows and add the following entries) | ||
|
||
``` | ||
127.0.0.1 randomquotes.local | ||
127.0.0.1 randomquotesdev.local | ||
127.0.0.1 randomquotestest.local | ||
127.0.0.1 randomquotesstaging.local | ||
127.0.0.1 randomquotesprod.local | ||
``` | ||
|
||
# Basic Deployment | ||
|
||
In the first activity we will do a standard manifest file deployment to the default namespace in kubernetes using `kubectl apply`. | ||
|
||
Instructions Lorem Ipsum | ||
|
||
# Leveraging Kustomize | ||
|
||
In the second activity we will deploy to each of the environment namespaces using kustomize and overlays. | ||
|
||
Instructions Lorem Ipsum | ||
|
||
# Using Octopus Deploy | ||
|
||
In the final activity we will configure Octopus Deploy to deploy our application to k8s using the manifest files. | ||
|
||
Instructions Lorem Ipsum |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
|
||
resources: | ||
- randomquotes-deployment.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: randomquotes-deployment | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
component: randomquotes-web | ||
template: | ||
metadata: | ||
labels: | ||
component: randomquotes-web | ||
spec: | ||
containers: | ||
- name: randomquotes-web | ||
image: octopussamples/randomquotes:0.0.1 | ||
resources: | ||
requests: | ||
memory: "64Mi" | ||
cpu: "250m" | ||
limits: | ||
memory: "128Mi" | ||
cpu: "500m" | ||
imagePullPolicy: "Always" | ||
ports: | ||
- containerPort: 5000 | ||
name: http-port | ||
env: | ||
- name: RANDOM_SECRET_PHRASE | ||
valueFrom: | ||
secretKeyRef: | ||
name: random-quotes-secrets | ||
key: homepageDisplay | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: randomquotes-app-cluster-ip-service | ||
spec: | ||
type: ClusterIP | ||
selector: | ||
component: randomquotes-web | ||
ports: | ||
- port: 6801 | ||
targetPort: 8080 | ||
--- | ||
apiVersion: networking.k8s.io/v1 | ||
kind: Ingress | ||
metadata: | ||
name: randomquotes-ingress-nginx | ||
spec: | ||
ingressClassName: nginx | ||
rules: | ||
- host: randomquotes.local | ||
http: | ||
paths: | ||
- path: / | ||
pathType: Prefix | ||
backend: | ||
service: | ||
name: randomquotes-app-cluster-ip-service | ||
port: | ||
number: 6801 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: random-quotes-secrets | ||
type: Opaque | ||
stringData: | ||
homepageDisplay: "blah" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: dev | ||
--- | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: testing | ||
--- | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: staging | ||
--- | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: production |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: octopus-svc-account | ||
namespace: default | ||
--- | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: octopus-svc-account-token | ||
namespace: default | ||
annotations: | ||
kubernetes.io/service-account.name: octopus-svc-account | ||
type: kubernetes.io/service-account-token | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: octopus-svc-account-role | ||
namespace: default | ||
rules: | ||
- apiGroups: | ||
- "" | ||
- apps | ||
- autoscaling | ||
- batch | ||
- extensions | ||
- policy | ||
- "rbac.authorization.k8s.io" | ||
- "networking.k8s.io" | ||
- secrets | ||
resources: | ||
- pods | ||
- componentstatuses | ||
- configmaps | ||
- daemonsets | ||
- deployments | ||
- events | ||
- endpoints | ||
- horizontalpodautoscalers | ||
- ingress | ||
- ingresses | ||
- jobs | ||
- limitranges | ||
- namespaces | ||
- nodes | ||
- pods | ||
- persistentvolumes | ||
- persistentvolumeclaims | ||
- resourcequotas | ||
- replicasets | ||
- replicationcontrollers | ||
- serviceaccounts | ||
- services | ||
- secrets | ||
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"] | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
name: octopus-svc-account-role-binding | ||
subjects: | ||
- namespace: default | ||
kind: ServiceAccount | ||
name: octopus-svc-account | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
name: octopus-svc-account-role |