Skip to content

Instantly share code, notes, and snippets.

@gitcrtn
Created December 20, 2020 09:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gitcrtn/697e66272db4a9618a86bf1cbaf9ad4f to your computer and use it in GitHub Desktop.
Save gitcrtn/697e66272db4a9618a86bf1cbaf9ad4f to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# Requirements:
# - WSL2 on Windows 10
# - Ubuntu 20.04
# - Docker 19.03.11+
# Install minikube
wget https://github.com/kubernetes/minikube/releases/download/v1.12.0-beta.0/minikube-linux-amd64
chmod +x ./minikube-linux-amd64
mv ./minikube-linux-amd64 minikube
sudo install minikube /usr/local/bin/
rm minikube
minikube start --vm-driver=docker
# Check minikube status
minikube version
minikube status
# Install kubectl
curl -LO "https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl"
chmod +x ./kubectl
sudo install kubectl /usr/local/bin/
rm kubectl
# Check kubectl status
kubectl version
kubectl get pods
# Deploy nginx pods and service
kubectl create deployment --image nginx my-nginx
kubectl scale deployment --replicas 2 my-nginx
kubectl get deployment
kubectl get pods
kubectl expose deployment my-nginx --port=80 --type=LoadBalancer
kubectl get services
kubectl port-forward svc/my-nginx 8080:80 &
# Access http://localhost:8080 from web browser
# Clean all resources up
kubectl delete svc my-nginx
kubectl delete deployment my-nginx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment