Renew kubernetes pki after expired

So the solution was to (first a backup) $ cd /etc/kubernetes/pki/ $ mv {apiserver.crt,apiserver-etcd-client.key,apiserver-kubelet-client.crt,front-proxy-ca.crt,front-proxy-client.crt,front-proxy-client.key,front-proxy-ca.key,apiserver-kubelet-client.key,apiserver.key,apiserver-etcd-client.crt} ~/ $ kubeadm init phase certs all –apiserver-advertise-address <IP> $ cd /etc/kubernetes/ $ mv {admin.conf,controller-manager.conf,kubelet.conf,scheduler.conf} ~/ $ kubeadm init phase kubeconfig all $ reboot then $ cp -i /etc/kubernetes/admin.conf $HOME/.kube/config that did the job for me and thanks for your hints … Read more

How to know a Pod’s own IP address from inside a container in the Pod?

The simplest answer is to ensure that your pod or replication controller yaml/json files add the pod IP as an environment variable by adding the config block defined below. (the block below additionally makes the name and namespace available to the pod) env: – name: MY_POD_NAME valueFrom: fieldRef: fieldPath: metadata.name – name: MY_POD_NAMESPACE valueFrom: fieldRef: … Read more

How to Enable KubeAPI server for HPA Autoscaling Metrics

I am able to implement HPA using metrics-server as heapster is depreciated. I have followed the following steps: Clone the metrics-server github repo: git clone https://github.com/kubernetes-incubator/metrics-server.git Go into directory cd deploy/1.8+ and run following yaml files: [root@ip-10-0-1-91 1.8+]# kubectl apply -f aggregated-metrics-reader.yaml clusterrole.rbac.authorization.k8s.io/system:aggregated-metrics-reader created [root@ip-10-0-1-91 1.8+]# kubectl apply -f auth-reader.yaml rolebinding.rbac.authorization.k8s.io/metrics-server-auth-reader created [root@ip-10-0-1-91 1.8+]# kubectl … Read more

Listing all resources in a namespace

Based on this comment , the supported way to list all resources is to iterate through all the api versions listed by kubectl api-resources: kubectl api-resources enumerates the resource types available in your cluster. this means you can combine it with kubectl get to actually list every instance of every resource type in a namespace: … Read more

Access mysql running on localhost from minikube

As the OS and minikube vm-driver wasn’t mentioned, I assume it is –vm-driver=virtualbox because it’s probably most common case. If you use something different you need to adjust this solution according to your configuration. Explanation: 127.0.0.1 is a localhost(lo0) interface IP address. Nodes, Hosts and Pods have their own localhost interfaces and they are not … Read more

Kubernetes: Routing non HTTP Request via Ingress to Container

This is not well supported via the ingress mechanism and is an open issue. There is a work around for tcp or udp traffic using nginx-ingress which will map an exposed port to a kubernetes service using a configmap. See this doc. Start the ingress controller with the tcp-services-configmap (and/or udp-services-configmap) argument. args: – “/nginx-ingress-controller” … Read more