From ea28043b90c6fe10d560862bb2bf8bd90b42bfbf Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Fri, 4 Feb 2022 10:15:58 -0800 Subject: [PATCH] kube upt to deployment --- Kubernetes/depoy_kubernetes.md | 64 ++++++++++++++++++++++++++++++++-- Kubernetes/installation.md | 2 +- 2 files changed, 63 insertions(+), 3 deletions(-) diff --git a/Kubernetes/depoy_kubernetes.md b/Kubernetes/depoy_kubernetes.md index 138f0bb..382e79d 100644 --- a/Kubernetes/depoy_kubernetes.md +++ b/Kubernetes/depoy_kubernetes.md @@ -12,6 +12,8 @@ kompose convert -f ~/docker-compose/docker-compose.yml ```commandline minikube start --insecure-registry="${LOCAL_IP}:5000" eval $(minikube docker-env) +# for RPI +minikube -p minikube docker-env ``` 3. Start processes @@ -19,11 +21,69 @@ eval $(minikube docker-env) kubectl apply -f $HOME/kube ``` -4. Stop processes +4Stop processes ```commandline kubectl delete -f $HOME/kube ``` +## Updating Service Information +In cases where standard `port-forwarding` doesn't work (ex. Minikube), user should attempt to change `ClusterIP` to `NodePort` in the +1. Edit the service you're unable to `port-forward` against +```commandline +kubectl edit service ${SERVICE_NAME} +``` + +2. replace `ClusterIP` to `NodePort`(using sed) +```yaml +# 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 +``` + +3. Generate `IP:PORT` to execute against +```commandline +minikube service --url ${SERVICE_NAME} +``` ## Commands * list (running) pods ```commandline @@ -47,5 +107,5 @@ kubectl logs ${POD_NAME} ``` * Port-Forwarding ```commandline -kubectl port-forward --address=${LOCAL_IP} service/${SERVICE_NAME} ${PORT}:${PORT} +kubectl port-forward --address=${LOCAL_IP} service/${SERVICE_NAME} LOCAL_PORT:REMOTE_PORT ``` \ No newline at end of file diff --git a/Kubernetes/installation.md b/Kubernetes/installation.md index a84efd4..7998ba7 100644 --- a/Kubernetes/installation.md +++ b/Kubernetes/installation.md @@ -30,7 +30,7 @@ sudo apt-get -y update sudo apt-get -y install curl curl -L https://github.com/kubernetes/kompose/releases/download/v1.26.1/kompose-linux-amd64 -o kompose chmod +x kompose -sudo mv ./kompose /usr/local/bin/kompose +sudo install ./kompose /usr/local/bin/kompose sudo apt-get update # Validate