Hello, this is the documentation of Swagger applied in our Kubernetes cluster.
There are 3 kind yaml files needed to build this application.
**1. Deployment**
Deployment are kubernetes manifest to tells Kubernetes how to create or modify instances of the pods that hold a containerized application.
```
apiVersion: apps/v1
kind: Deployment
metadata:
name: swagger-ui
labels:
app: swagger-ui
spec:
replicas: 1
selector:
matchLabels:
app: swagger-ui
template:
metadata:
labels:
app: swagger-ui
spec:
containers:
- name: swagger-ui
image: swaggerapi/swagger-ui
ports:
- containerPort: 8080
```
**2. Service**
This yaml used to define networking service for our deployment in kubernetes. We use the NodePort type here
```
apiVersion: v1
kind: Service
metadata:
name: swagger-ui
spec:
selector:
app: swagger-ui
ports:
- protocol: TCP
port: 8080
targetPort: 8080
type: NodePort
```
**3. Ingress**
Ingress change the *IP_Address:Port* endpoint into a domain. In this service, we use domain [swagger.openetra.net](http:/swagger.openetra.net/) with nginx ingress controller installed before.
```
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: swagger
annotations:
kubernetes.io/ingress.class: nginx
spec:
rules:
- host: swagger.openetra.net
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: swagger-ui
port:
number: 8080
```
**Applying all the manifest**
To deploy all the manifest, we can deploy it one per one or deploy only one file that contains all the manifest (deployment, service, ingress)
```
$ kubectl apply -f deployment.yaml -n default
```
```
$ kubectl apply -f service.yaml -n default
```
```
$ kubectl apply -f ingress.yaml -n default
```
**Acessing dashboard**
To access the dashboard of swagger, we can us the link [here](http:/swagger.openetra.net/)

nb: ensure the host are mapped in local dns (10.30.1.214 swagger.openetra.net)