- convert docker-compose for kubernetes
mkdir $HOME/kube
cd $HOME/kube
kompose convert -f ~/docker-compose/docker-compose.yml
- Start minikube & Evaluate
minikube start --insecure-registry="${LOCAL_IP}:5000"
eval $(minikube docker-env)
# for RPI
minikube -p minikube docker-env
- Start processes
kubectl apply -f $HOME/kube
4Stop processes
kubectl delete -f $HOME/kube
In cases where standard port-forwarding
doesn't work (ex. Minikube), user should attempt to change ClusterIP
to NodePort
in the
- Edit the service you're unable to
port-forward
against
kubectl edit service ${SERVICE_NAME}
- replace
ClusterIP
toNodePort
(using sed)
# before
ports:
- name: "13480"
nodePort: 31266
port: 13480
protocol: TCP
targetPort: 13480
- name: "13481"
nodePort: 31956
port: 13481
protocol: TCP
targetPort: 13481
- name: "13482"
nodePort: 31296
port: 13482
protocol: TCP
targetPort: 13482
selector:
io.kompose.service: ${SERVICE_NAME}
sessionAffinity: None
type: ClusterIP
# after
ports:
- name: "13480"
nodePort: 31266
port: 13480
protocol: TCP
targetPort: 13480
- name: "13481"
nodePort: 31956
port: 13481
protocol: TCP
targetPort: 13481
- name: "13482"
nodePort: 31296
port: 13482
protocol: TCP
targetPort: 13482
selector:
io.kompose.service: ${SERVICE_NAME}
sessionAffinity: None
type: NodePort
- Generate
IP:PORT
to execute against
minikube service --url ${SERVICE_NAME}
- list (running) pods
kubectl get pods
- Access shell node correlated to a specific pod
kubectl exec -it ${POD_NAME} -- /bin/bash
- Get services
kubectl get services
- Describe pod
kubectl describe pod ${POD_NAME}
- Pod logs - shows program output
kubectl logs ${POD_NAME}
- Port-Forwarding
kubectl port-forward --address=${LOCAL_IP} service/${SERVICE_NAME} LOCAL_PORT:REMOTE_PORT