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
function createXMLHttpRequestObject(){ | |
if(window.XMLHttpRequest){ | |
xmlHTTPRequest = new XMLHttpRequest(); | |
} | |
else{ | |
xmlHTTPRequest = new ActiveXObject("Microsoft.XMLHTTP"); | |
} | |
return xmlHTTPRequest; | |
} |
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
package main | |
import ( | |
"encoding/json" | |
"log" | |
"net/http" | |
"os" | |
"github.com/gorilla/mux" | |
) |
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
FROM golang:1.11 | |
RUN mkdir /go/src/app | |
ADD . /go/src/app | |
WORKDIR /go/src/app | |
#install the external dependecny that we have in the code | |
RUN go get -u github.com/gorilla/mux | |
#make the build of the app, output will be an executable file named main |
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
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: restapi-deployment | |
labels: | |
app: restapi | |
spec: | |
replicas: 3 | |
selector: | |
matchLabels: |
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
apiVersion: v1 | |
metadata: | |
name: restapi-service | |
spec: | |
selector: | |
app: restapi | |
ports: | |
- protocol: TCP | |
port: 8081 | |
targetPort: 8080 |
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
apiVersion: extensions/v1beta1 | |
kind: Ingress | |
metadata: | |
name: restapi-ing | |
spec: | |
rules: | |
- http: | |
paths: | |
- path: /api/books | |
backend: |
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
kind: PersistentVolume | |
apiVersion: v1 | |
metadata: | |
name: mysql-pv-volume | |
labels: | |
type: local | |
spec: | |
storageClassName: manual | |
capacity: | |
storage: 10Gi |
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
kind: PersistentVolumeClaim | |
apiVersion: v1 | |
metadata: | |
name: mysql-pv-claim | |
spec: | |
storageClassName: manual | |
accessModes: | |
- ReadWriteOnce | |
resources: | |
requests: |
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
kind: Deployment | |
apiVersion: apps/v1 | |
metadata: | |
name: mysql | |
spec: | |
replicas: 1 | |
selector: | |
matchLabels: | |
app: mysql | |
strategy: |
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
# Create a pod named nginx-pod with image nginx and 3 replicas | |
kubectl run nginx-pod --generator=run-pod/v1 --image=nginx --replicas=3 | |
# create a deployment named nginx-deploy with image nginx and 3 replicas, alternative of below command is kubectl create deployment | |
kubectl run nginx-deploy --image=nginx --replicas=3 | |
# Dont actually create the resources in the cluster, just create the manifest for above commands/resource | |
# below command will create a file named pod.yaml that will be the manifest to create the pod with require specification. | |
kubectl run nginx-pod --generator=run-pod/v1 --image=nginx --replicas=3 --dry-run -oyaml > pod.yaml |
OlderNewer