I am operating on a Fedora 31 OS with docker installed, I can run minikube on my machine directly (rather than in a vm) with docker by specifying minikube with --driver=docker
.
I think this will be fine for development/exploration.
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 mv kubectl /usr/local/bin
kubectl version --client
curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
chmod +x minikube
sudo mv minikube /usr/local/bin
minikube start --driver=docker
π minikube v1.9.2 on Fedora 31
β¨ Using the docker driver based on user configuration
π Starting control plane node m01 in cluster minikube
π Pulling base image ...
πΎ Downloading Kubernetes v1.18.0 preload ...
> preloaded-images-k8s-v2-v1.18.0-docker-overlay2-amd64.tar.lz4: 542.91 MiB
π₯ Creating Kubernetes in docker container with (CPUs=2) (8 available), Memory=3900MB (15769MB available) ...
π³ Preparing Kubernetes v1.18.0 on Docker 19.03.2 ...
βͺ kubeadm.pod-network-cidr=10.244.0.0/16
π Enabling addons: default-storageclass, storage-provisioner
π Done! kubectl is now configured to use "minikube"
minikube status
m01
host: Running
kubelet: Running
apiserver: Running
kubeconfig: Configured
kubectl cluster-info
Kubernetes master is running at https://172.17.0.2:8443
KubeDNS is running at https://172.17.0.2:8443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
To stop
minikube stop
To clean up local state
minikube delete
minikube start --driver=docker
kubectl create namespace flask
kubectl get namespace
cat flask-pod.yaml
cat <<EOF > flask-pod.yaml
apiVersion: v1
kind: Pod
metadata:
name: flask-pod
labels:
app: flask-helloworld
spec:
containers:
- name: flask
image: digitalocean/flask-helloworld:latest
ports:
- containerPort: 5000
EOF
kubectl apply -f flask-pod.yaml -n flask
kubectl get pod -n flask
kubectl describe pod -n flask
kubectl port-forward pods/flask-pod -n flask 5000:5000
When we are ready to move on
kubectl delete pod flask-pod -n flask
cat <<EOF > flask-deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: flask-dep
labels:
app: flask-helloworld
spec:
replicas: 2
selector:
matchLabels:
app: flask-helloworld
template:
metadata:
labels:
app: flask-helloworld
spec:
containers:
- name: flask
image: digitalocean/flask-helloworld:latest
ports:
- containerPort: 5000
EOF
kubectl apply -f flask-deployment.yaml -n flask
kubectl get deploy -n flask
kubectl get pod -n flask
kubectl port-forward deployment/flask-dep -n flask 5000:5000
kubectl rollout status deployment/flask-dep -n flask
kubectl get replicaset -n flask
kubectl rollout restart deployment/flask-dep -n flask
kubectl scale --current-replicas=2 --replicas=3 deployment/flask-dep -n flask
kubectl get replicaset -n flask
kubectl get deploy -n flask
kubectl get pods -n flask
cat <<EOF > flask-service.yaml
apiVersion: v1
kind: Service
metadata:
name: flask-svc
labels:
app: flask-helloworld
spec:
type: LoadBalancer
ports:
- port: 80
targetPort: 5000
protocol: TCP
selector:
app: flask-helloworld
EOF
kubectl apply -f flask-service.yaml -n flask
kubectl get svc -n flask
minikube service flask-svc -n flask
kubectl delete svc flask-svc -n flask
kubectl delete deploy flask-dep -n flask
kubectl delete namespace flask