Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(recipes): Update Kubernetes deployment instructions #526

Merged
merged 3 commits into from
Jan 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions docs/recipes/docker-server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,16 @@ gcloud config set compute/zone "$COMPUTE_ZONE"
# Create our Kubernetes cluster for LHCI
gcloud container clusters create lhci-cluster --num-nodes=1

# Deploy the LHCI server pod
curl https://raw.githubusercontent.com/GoogleChrome/lighthouse-ci/master/docs/recipes/docker-server/kubernetes/lhci-data-claim.yml > lhci-data-claim.yml
curl https://raw.githubusercontent.com/GoogleChrome/lighthouse-ci/master/docs/recipes/docker-server/kubernetes/lhci-pod.yml > lhci-pod.yml
# Deploy the LHCI server
curl -O https://raw.githubusercontent.com/GoogleChrome/lighthouse-ci/master/docs/recipes/docker-server/kubernetes/lhci-data-claim.yml
curl -O https://raw.githubusercontent.com/GoogleChrome/lighthouse-ci/master/docs/recipes/docker-server/kubernetes/lhci-deployment.yml
curl -O https://raw.githubusercontent.com/GoogleChrome/lighthouse-ci/master/docs/recipes/docker-server/kubernetes/lhci-service.yml
kubectl apply -f ./lhci-data-claim.yml
kubectl apply -f ./lhci-pod.yml
kubectl apply -f ./lhci-deployment.yml
kubectl apply -f ./lhci-service.yml

# Make sure our pod was created successfully
kubectl get pods

# Expose LHCI to the internet
kubectl expose pod lhci-pod --type=LoadBalancer --port 80 --target-port 9001 --name=lhci-server
# Make sure our deployment was created successfully
kubectl get deployment

# Check the IP of your LHCI server installation!
kubectl get service
Expand Down
34 changes: 34 additions & 0 deletions docs/recipes/docker-server/kubernetes/lhci-deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: lhci-server
spec:
selector:
matchLabels:
name: lhci-server
# there can be only one pod at a time because of the persistent volume claim
strategy:
type: Recreate
template:
metadata:
name: lhci-pod
labels:
name: lhci-server
spec:
containers:
- name: lhci-server
image: docker.io/patrickhulce/lhci-server:0.6.1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you update the line in the update-dockerhub.sh script that replaces this value? it's pointing to the now non-existent lhci-pod.yml

volumeMounts:
- mountPath: '/data'
name: lhci-data-volume
# required for ingress health checks to work
ports:
- containerPort: 9001
readinessProbe:
httpGet:
path: /app/
port: 9001
volumes:
- name: lhci-data-volume
persistentVolumeClaim:
claimName: lhci-data-claim
31 changes: 31 additions & 0 deletions docs/recipes/docker-server/kubernetes/lhci-ingress.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
apiVersion: v1
kind: Service
metadata:
name: lhci-server
spec:
ports:
- port: 80
targetPort: 9001
selector:
name: lhci-server
type: NodePort
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: lhci-server
annotations:
kubernetes.io/ingress.global-static-ip-name: lhci-example-com
networking.gke.io/managed-certificates: lhci-example-com
spec:
backend:
serviceName: lhci-server
servicePort: 80
---
apiVersion: networking.gke.io/v1beta2
kind: ManagedCertificate
metadata:
name: lhci-example-com
spec:
domains:
- lhci.example.com
17 changes: 0 additions & 17 deletions docs/recipes/docker-server/kubernetes/lhci-pod.yml

This file was deleted.

11 changes: 11 additions & 0 deletions docs/recipes/docker-server/kubernetes/lhci-service.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
kind: Service
metadata:
name: lhci-server
spec:
ports:
- port: 80
targetPort: 9001
selector:
name: lhci-server
type: LoadBalancer
2 changes: 1 addition & 1 deletion docs/recipes/docker-server/update-dockerhub.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ read -n 1 -p "Press any key to continue, Ctrl+C to exit..."

printf "\nUpdating local files...\n\n"

sed -i "" "s/$CURRENT_VERSION/$LATEST_VERSION/" package.json kubernetes/lhci-pod.yml
sed -i "" "s/$CURRENT_VERSION/$LATEST_VERSION/" package.json kubernetes/lhci-deployment.yml
git --no-pager diff .

printf "Continue publishing $LATEST_VERSION?\n"
Expand Down