Minikube expose MySQL running on localhost as service

Kubernetes allows you to create a service without selector, and cluster will not create related endpoint for this service, this feature is usually used to proxy a legacy component or an outside component. Create a service without selector apiVersion: v1 kind: Service metadata: name: my-service spec: ports: – protocol: TCP port: 1443 targetPort: <YOUR_MYSQL_PORT> Create … Read more

Checking kubernetes pod CPU and memory

CHECK WITHOUT METRICS SERVER or ANY THIRD PARTY TOOL If you want to check pods cpu/memory usage without installing any third party tool then you can get memory and cpu usage of pod from cgroup. Go to pod’s exec mode kubectl exec -it pod_name -n namespace — /bin/bash Run cat /sys/fs/cgroup/cpu/cpuacct.usage for cpu usage Run … Read more

Is it possible to Autoscale Akka

If you consider a project like hseeberger/constructr and its issue 179, a native Akka solution should be based on akka/akka-management: This repository contains interfaces to inspect, interact and manage various Parts of Akka, primarily Akka Cluster. Future additions may extend these concepts to other parts of Akka. There is a demo for kubernetes.

Inject node labels into Kubernetes pod

I thought about was having the container query the kubernetes/AWS API to fetch this information however that would mean adding quite a lot of complexity to my containers. This is currently the recommended approach for getting information not available in the downward API. To avoid the additional complexity in your containers, you could use a … Read more

Connect to local database from inside minikube cluster

I’m using ubuntu with Minikube and my database runs outside of minikube inside a docker container and can be accessed from localhost @ 172.17.0.2. My Kubernetes service for my external mysql container reads as follows: kind: Service apiVersion: v1 metadata: name: mysql-db-svc namespace: external spec: type: ExternalName externalName: 10.0.2.2 Then inside my .env for a … Read more

How can I edit a Deployment without modify the file manually?

You could do it via the REST API using the PATCH verb. However, an easier way is to use kubectl patch. The following command updates your app’s tag: kubectl patch deployment myapp-deployment -p \ ‘{“spec”:{“template”:{“spec”:{“containers”:[{“name”:”myapp”,”image”:”172.20.34.206:5000/myapp:img:3.0″}]}}}}’ According to the documentation, YAML format should be accepted as well. See Kubernetes issue #458 though (and in particular this … Read more

How can I debug “ImagePullBackOff”?

You can use the ‘describe pod‘ syntax For OpenShift use: oc describe pod <pod-id> For vanilla Kubernetes: kubectl describe pod <pod-id> Examine the events of the output. In my case it shows Back-off pulling image unreachableserver/nginx:1.14.22222 In this case the image unreachableserver/nginx:1.14.22222 can not be pulled from the Internet because there is no Docker registry … Read more

Can a PVC be bound to a specific PV?

There is a way to pre-bind PVs to PVCs today, here is an example showing how: Create a PV object with a ClaimRef field referencing a PVC that you will subsequently create: $ kubectl create -f pv.yaml persistentvolume “pv0003” created where pv.yaml contains: apiVersion: v1 kind: PersistentVolume metadata: name: pv0003 spec: storageClassName: “” capacity: storage: … Read more