skaffold demo

This commit is contained in:
Edward Viaene
2019-11-21 14:44:47 +01:00
parent a763e1524a
commit 1fe2e04ab7
5 changed files with 58 additions and 0 deletions

7
skaffold-demo/Dockerfile Normal file
View File

@@ -0,0 +1,7 @@
FROM golang:1.12.9-alpine3.10 as builder
COPY main.go .
RUN go build -o /app main.go
FROM alpine:3.10
CMD ["./app"]
COPY --from=builder /app .

3
skaffold-demo/go.mod Normal file
View File

@@ -0,0 +1,3 @@
module github.com/wardviaene/kubernetes-course/skaffold-demo
go 1.13

View File

@@ -0,0 +1,23 @@
apiVersion: v1
kind: Pod
metadata:
name: skaffold-demo
labels:
app: skaffold-demo
spec:
containers:
- name: skaffold-demo
image: wardviaene/skaffold-demo
---
apiVersion: v1
kind: Service
metadata:
name: skaffold-demo
spec:
selector:
app: skaffold-demo
type: LoadBalancer
ports:
- protocol: TCP
port: 80
targetPort: 8080

16
skaffold-demo/main.go Normal file
View File

@@ -0,0 +1,16 @@
package main
import (
"fmt"
"net/http"
)
func main() {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "hello world - go crazy!")
})
fmt.Printf("Listening on port 8080\n")
http.ListenAndServe(":8080", nil)
}

View File

@@ -0,0 +1,9 @@
apiVersion: skaffold/v1
kind: Config
build:
artifacts:
- image: wardviaene/skaffold-demo
deploy:
kubectl:
manifests:
- k8s-*