How to assign a namespace to certain nodes?

To achieve this you can use PodNodeSelector admission controller. First, you need to enable it in your kubernetes-apiserver: Edit /etc/kubernetes/manifests/kube-apiserver.yaml: find –enable-admission-plugins= add PodNodeSelector parameter Now, you can specify scheduler.alpha.kubernetes.io/node-selector option in annotations for your namespace, example: apiVersion: v1 kind: Namespace metadata: name: your-namespace annotations: scheduler.alpha.kubernetes.io/node-selector: env=test spec: {} status: {} After these steps, all … Read more

Retrieve the full name of a service in Kubernetes

You can do a DNS query from any pod and you would get the FQDN. # nslookup api-server Server: 10.96.0.10 Address: 10.96.0.10#53 Name: api-server.default.svc.cluster.local Address: 10.104.225.18 root@api-server-6ff8c8b9c-6pgkb:/# cluster-domain.example is just a example in the documentation. cluster.local is the default cluster domain assigned. So the FQDN of any service by default would be <service-name>.<namespace>.svc.cluster.local. You don’t … Read more

Kubernetes Job Cleanup

It looks like starting with Kubernetes 1.6 (and the v2alpha1 api version), if you’re using cronjobs to create the jobs (that, in turn, create your pods), you’ll be able to limit how many old jobs are kept. Just add the following to your job spec: successfulJobsHistoryLimit: X failedJobsHistoryLimit: Y Where X and Y are the … Read more

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

What’s the kube-public namespace for?

That namespace exists in clusters created with kubeadm for now. It contains a single ConfigMap object, cluster-info, that aids discovery and security bootstrap (basically, contains the CA for the cluster and such). This object is readable without authentication. If you are courious: $ kubectl get configmap -n kube-public cluster-info -o yaml There are more details … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)