Skip to content

Commit

Permalink
update example ingress
Browse files Browse the repository at this point in the history
  • Loading branch information
ledongthuc committed Nov 26, 2019
1 parent bec5193 commit 61ab5ad
Show file tree
Hide file tree
Showing 8 changed files with 146 additions and 0 deletions.
17 changes: 17 additions & 0 deletions k8s/jobs/service_with_ingress_nginx/README.md
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
```


20 changes: 20 additions & 0 deletions k8s/jobs/service_with_ingress_nginx/default.yaml
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
14 changes: 14 additions & 0 deletions k8s/jobs/service_with_ingress_nginx/ingress.yaml
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
11 changes: 11 additions & 0 deletions k8s/jobs/service_with_ingress_nginx/service.yaml
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
21 changes: 21 additions & 0 deletions k8s/jobs/simple_http_server/README.md
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
```
20 changes: 20 additions & 0 deletions k8s/jobs/simple_http_server/default.yaml
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
11 changes: 11 additions & 0 deletions k8s/jobs/simple_http_server/service.yaml
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
32 changes: 32 additions & 0 deletions k8s/setup/minikube.md
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
```

0 comments on commit 61ab5ad

Please sign in to comment.