-
Notifications
You must be signed in to change notification settings - Fork 1
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
bec5193
commit 61ab5ad
Showing
8 changed files
with
146 additions
and
0 deletions.
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Service with ingress nginx | ||
|
||
1. Install ingress nginx controller | ||
|
||
``` | ||
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/static/mandatory.yaml | ||
``` | ||
|
||
https://kubernetes.github.io/ingress-nginx/deploy/ | ||
|
||
2. Verify installation | ||
|
||
``` | ||
kubectl get pods --all-namespaces -l app.kubernetes.io/name=ingress-nginx | ||
``` | ||
|
||
|
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,20 @@ | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: http-app | ||
spec: | ||
selector: | ||
matchLabels: | ||
app: http-server | ||
template: | ||
metadata: | ||
labels: | ||
app: http-server | ||
spec: | ||
containers: | ||
- | ||
args: | ||
- "-text=Hello world" | ||
image: "hashicorp/http-echo:latest" | ||
name: http-server |
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,14 @@ | ||
apiVersion: extensions/v1beta1 | ||
kind: Ingress | ||
metadata: | ||
name: http-app-ingress | ||
annotations: | ||
kubernetes.io/ingress.class: "nginx" # ingress will scan it | ||
spec: | ||
rules: | ||
- http: | ||
paths: | ||
- path: /sub-path | ||
backend: | ||
serviceName: http-app-service | ||
servicePort: 5678 |
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,11 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: http-app-service | ||
spec: | ||
type: NodePort | ||
ports: | ||
- port: 5678 | ||
selector: | ||
app: http-server |
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,21 @@ | ||
# Simple http server | ||
|
||
1. Apply deployment and service | ||
|
||
``` | ||
kubectl apply ./ | ||
``` | ||
|
||
2. Expose the deployment to outside | ||
|
||
It's based on K8S environment. If we use minikube, please use: | ||
|
||
``` | ||
minikube service http-app-service | ||
``` | ||
|
||
3. Browse the cluster with exposed service IP | ||
|
||
``` | ||
Hello world | ||
``` |
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,20 @@ | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: http-app | ||
spec: | ||
selector: | ||
matchLabels: | ||
app: http-server | ||
template: | ||
metadata: | ||
labels: | ||
app: http-server | ||
spec: | ||
containers: | ||
- | ||
args: | ||
- "-text=Hello world" | ||
image: "hashicorp/http-echo:latest" | ||
name: http-server |
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,11 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: http-app-service | ||
spec: | ||
type: NodePort | ||
ports: | ||
- port: 5678 | ||
selector: | ||
app: http-server |
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,32 @@ | ||
# Minikube | ||
|
||
## Installation | ||
|
||
Prerequirement: | ||
- hypervisor (KVM, virtual box) | ||
- docker | ||
|
||
https://minikube.sigs.k8s.io/docs/start/macos/ | ||
|
||
Note: | ||
- Sometime we need to restart to manachine to make hypervisor and minikube work together | ||
|
||
## Commands | ||
|
||
- Start minikube: | ||
|
||
``` | ||
minikube start | ||
``` | ||
|
||
- Check minikube status: | ||
|
||
``` | ||
minikube status | ||
``` | ||
|
||
- Start dashboard with minikube: | ||
|
||
``` | ||
minikube dashboard | ||
``` |