prompt
stringlengths
65
38.7k
response
stringlengths
41
29.1k
<p>I am trying to deploy an application to Google Cloud Platform. I have my back-end and my front-end running in separate docker containers, each project have his own Docker-Compose and Dockerfile , I am using a container for my Postgres database. I deployed my containers to Dockerhub, and I created Kubernetes services...
<blockquote> <p>what are the correct steps to follow after running my Kubernetes services and dockerizing my application in order to deploy it on Google Cloud Platform?</p> </blockquote> <p>After you created a cluster in GCP, you need to create deployments and services for your front-end and back-end application...
<p>Using google Kubernetes engine:</p> <pre><code>kubectl cluster-info kubernetes-dashboard is running at https://x.x.x.x/api/v1/namespaces/kube-system/services/kubernetes-dashboard/proxy </code></pre> <p>If I go to the link:</p> <p>I get to a forbidden page and if I accepts I get the following:</p> <pre><code>{ ...
<p>This message says, you should login with valid authentication to the UI Dashboard it can be with token or cluster config. If you want to login using token, follow the steps below:</p> <ol> <li><p>Get list of all secret tokens:</p> <p>kubectl -n kube-system get secret</p></li> <li><p>Get the token:</p> <p>kubectl ...
<p><strong>Problem</strong></p> <p>I have a Kafka setup with three brokers in Kubernetes, set up according to the guide at <a href="https://github.com/Yolean/kubernetes-kafka" rel="nofollow noreferrer">https://github.com/Yolean/kubernetes-kafka</a>. The following error message appears when producing messages from a Ja...
<p>This problem normally occurs when the producer is faster than the brokers, the reason why this happens with your setup seems to be that the SSL needs extra CPU and that may slow down the brokers. But anyway check the following:</p> <ul> <li>Check if you are producing message at the same speed, according what you ar...
<p>This is my worker node:</p> <pre><code>root@ivu:~# kubeadm join 10.16.70.174:6443 --token hl36mu.0uptj0rp3x1lfw6n --discovery-token-ca-cert-hash sha256:daac28160d160f938b82b8c720cfc91dd9e6988d743306f3aecb42e4fb114f19 --ignore-preflight-errors=swap [preflight] Running pre-flight checks. [WARNING Swap]: runni...
<p>I had this problem and it was solved by ensuring that cgroup driver on the <em>worker</em> nodes also were set properly.</p> <p>check with:</p> <pre><code>docker info | grep -i cgroup cat /etc/systemd/system/kubelet.service.d/10-kubeadm.conf </code></pre> <p>set it with:</p> <pre><code>sed -i "s/cgroup-driver=sy...
<p>I set up a high-availability Kubernetes cluster by following the official <a href="https://kubernetes.io/docs/setup/independent/high-availability/" rel="nofollow noreferrer">Creating HA clusters with kubeadm</a> guide. It is an experimental cluster for exploring the feasibility of a on-premises high-availability dep...
<p>The details at the end of the error message (<code>context deadline expired</code>), suggest a timeout (Go's <a href="https://golang.org/pkg/context/" rel="nofollow noreferrer">context package</a> is used for handling timeouts). But I wasn't seeing any slowness when I accessed the etcd cluster directly via etcdctl, ...
<p>I have been running a pod for more than a week and there has been no restart since started. But, still I am unable to view the logs since it started and it only gives logs for the last two days. Is there any log rotation policy for the container and how to control the rotation like based on size or date?</p> <p>I t...
<blockquote> <p>Is there any log rotation policy for the container and how to control the rotation like based on size or date</p> </blockquote> <p>The log rotation is controlled by the docker <code>--log-driver</code> and <code>--log-opts</code> (or their <a href="https://docs.docker.com/engine/reference/commandline...
<p>I have a integration Kubernetes cluster in AWS, and I want to conduct end-to-end tests on that cluster. </p> <p>I currently use Deployments and Services.</p> <p>The proposed approach is to use Ingress and configure it to use cookie injection for ensuring access to web page that implements the following logic:</p> ...
<p>It sounds like either <a href="https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations/#configuration-snippet" rel="nofollow noreferrer">configuration-snippet</a> or a full-blown <a href="https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/custom-template/" rel="no...
<p>I setup my cluster with one master and two nodes. I can create pods on nodes. If my master node fails (reboot) when I use kubeadm reset and then kubeadm init I lost all my pods, deployments, services.</p> <p>Am I losting my pods because reset? What should I do?</p> <p>Some similar questions:</p> <p><a href="https...
<p><code>kubeadm reset</code> on the master deletes all configuration (files and a database too). There is no way back.</p> <p>You should not run <code>kubeadm init</code> when you reboot the master. <code>kubeadm init</code> is a one off action to bootstrap the cluster. When the master is rebooted your OS's init syst...
<p>I am trying to provision PV with RBD using <a href="https://github.com/kubernetes/kubernetes/tree/release-1.7/examples/persistent-volume-provisioning/rbd" rel="nofollow noreferrer">https://github.com/kubernetes/kubernetes/tree/release-1.7/examples/persistent-volume-provisioning/rbd</a></p> <p>But I have faced an is...
<p>It seems you don't have volume defined in your pvc :</p> <p><a href="https://i.stack.imgur.com/54mos.png" rel="noreferrer"><img src="https://i.stack.imgur.com/54mos.png" alt="missing_volume"></a></p> <p>I got the problem also if the volumeName is not correct or if it doesn't exist. Indeed, there are no logs or eve...
<p>I have developed a nodejs REST API, for which i have built a docker image and now deploying it as a pod on my kubernetes cluster.</p> <p>Dockerfile</p> <pre><code>FROM mhart/alpine-node:8 WORKDIR /home/appHome/ COPY package*.json ./ RUN npm install COPY . . EXPOSE 3000 CMD [ "npm", "start" ] </code></pre> <p>howe...
<p>If you want to use Kubernetes only, then using Jobs would be the easiest way. A job creates one or more pods and ensures that a specified number of them successfully terminate. As pods successfully complete, the job tracks the successful completions. When a specified number of successful completions is reached, the ...
<p>Hy</p> <p>We're trying to get our website working on kubernetes (running in a container using nginx). We use ingress to route to the site, here is our configuration:</p> <p>nginx-conf:</p> <pre><code>server { listen 80; location / { root /usr/share/nginx/html; index index.html index.htm; try_files...
<p>This is not a routing problem on nginx part, but the browser trying to access an absolute URI from the root of your domain. Use relative URIs (remove the leading slash):</p> <pre><code>&lt;link href="styles.30457fcf45ea2da7cf6a.css" rel="stylesheet"&gt;&lt;/head&gt; &lt;script type="text/javascript" src="app.171d6a...
<p>Does anyone know how to import the data inside my dump.sql file to a kubernetes pod either;</p> <p>Directly,same way as you dealing with docker containers:</p> <pre><code>docker exec -i container_name mysql -uroot --password=secret database &lt; Dump.sql </code></pre> <p>Or using the data stored in an existing do...
<p>Just if other people are searching for this : </p> <pre><code>kubectl -n namespace exec -i my_sql_pod_name -- mysql -u user -ppassword &lt; my_local_dump.sql </code></pre>
<p>The following is the k8s definition used:</p> <pre><code>apiVersion: v1 kind: PersistentVolumeClaim metadata: name: nfs-pv-provisioning-demo labels: demo: nfs-pv-provisioning spec: accessModes: [ "ReadWriteOnce" ] resources: requests: storage: 200Gi --- apiVersion: v1 kind: ReplicationControll...
<p>Have you tried <a href="https://kubernetes.io/docs/concepts/workloads/pods/init-containers/" rel="noreferrer">initContainers</a> method? It fixes permissions on an exported directory:</p> <pre><code>initContainers: - name: volume-mount-hack image: busybox command: ["sh", "-c", "chmod -R 777 /exports...
<p>In my setup, there is a set of containers that were initially built to run with <code>docker-compose</code>. After moving to Kubernetes I'm facing the following challenges:</p> <ol> <li><code>docker-compose</code> managed to provide some type of internal DNS that allowed a container to be addressed by its name. How ...
<blockquote> <p>Docker-compose managed to provide some type of internal DNS that allowed a container to be addressed by its name. How do I create such a network in Kubernetes?</p> </blockquote> <p>As you researched, you can, indeed have two approaches:</p> <ul> <li><p><strong>IF</strong> you containers are to be <s...
<p>is jsonPath supported in kubernetes http api ?</p> <p>for ex; how the following translates to in http API ?</p> <pre><code>kubectl get pods -o=jsonpath='{.items[0]}' </code></pre>
<p>It's not supported by the API, you would need to evaluate that jsonpath against the API response. </p>
<p>I have a microservice deployed in a Tomcat container/pod. There are four different files generated in the container - access.log, tomcat.log, catalina.out and application.log (log4j output). What is the best approach to send these logs to Elasticsearch (or similar platform). </p> <p>I read through the information o...
<p>Yes, the best option for your use case is to have to have one <code>tail -f</code> sidecar per log file and then install either a <code>fluentd</code> or a <code>fluent-bit</code> daemonset that will handle shipping and enriching the log events. </p> <p>The <a href="https://github.com/kubernetes/kubernetes/tree/ma...
<p>I would like my application hosted in an Openshift cluster to target an external REST API without hardcoding IP/PORT in the client application, and also to be able to change IP/PORT without redelivering the application.</p> <p>I managed to do it through ConfigMap, but I saw it may also be possible to do through Ser...
<p>In your endpoint configuration, change the name of port 80 (<code>"80"</code>) to <code>http</code>. It needs to be the same as in the service configuration.</p>
<p>I understood that </p> <ul> <li><code>StatefulSet</code> - manages/maintains stable hostname, network ID and persistent storage. </li> <li><code>HeadlessService</code> - stable network ID you need to define a headless service for stateful applications</li> </ul> <blockquote> <p>FROM K8s Docs -> Sometimes you don...
<p>Before trying to answer some of your questions I must add disclaimer: there are different ways to skin a cat. And since we are discussing StatefulSets here note that not all approaches are best suited for all stateful applications. In case that you need a single database pod with single PV, you could have one approa...
<p>Was there a recent change to Nginx Ingress? Out of the blue I'm now getting "Connection refused" errors. I thought it was my own configuration which worked on a previous cluster.</p> <p>Instead I decided to follow this tutorial <a href="https://cloud.google.com/community/tutorials/nginx-ingress-gke" rel="noreferrer...
<p>That's because you are trying the request against the IP address created by the Ingress. Your entrypoint is the LoadBalancer type service created IP.</p> <p>Try <code>curl -I http://35.227.50.24/hello</code>. That's where you will get 200.</p>
<p>Our service is running in kubernetes cluster. I'm trying to make our service to be secured by SSL. </p> <p>For that purpose I added to application.properties:</p> <pre><code>security.require-ssl=true server.ssl.key-store-type=JKS server.ssl.key-store=serviceCertificates.jks server.ssl.key-store-password=${KEYST...
<p>I think there is typo or hidden character in your secret descriptor. You can exec into the pod , verify the system property and also try decrypting the password using command line tools. </p>
<p>I'm using Cloud composer to orchestrate my airflow instance but not sure how to install packages for the airflow worker bash.</p> <p>Previously I was running airflow on a google compute engine instance using docker, it was easy to specify requirements via the docker make file.</p> <p>As someone who is new to kuber...
<p>At the moment, if I read the documentation correctly, you cannot modify the images used by Composer. Unless you deploy your custom solution on a Kubernetes cluster, I think you cannot extend it beyond Python Libraries and Airflow Plugins. </p> <p>You can ssh into each worker Compute Engine instance and install it m...
<p>I can create config map from a property file and use the same config files inside the POD. However, I don't want to use the configmap created in past and supplied with the helmchart. Rather in the helmchart values.yaml i want to provide a file name from where the config map will be created dynamically ..</p> <p>Any...
<p>See if the approach described in <a href="https://github.com/kubernetes/charts/issues/1310" rel="nofollow noreferrer">kubernetes/charts issue 1310</a> works for you.</p> <blockquote> <p>I suggest that we allow for overriding the name of the <code>ConfigMap</code> that gets mounted to the persistent volume.<br> ...
<p>How can one define log retention for kubernetes pods? For now it seems like the log file size is not limited, and it is uses the host machine complete resources.</p>
<p>According to <a href="https://kubernetes.io/docs/concepts/cluster-administration/logging/" rel="noreferrer">Logging Architecture</a> from kubernetes.io there are some options</p> <p><strong>First option</strong></p> <blockquote> <p>Kubernetes currently is not responsible for rotating logs, but rather a deploym...
<p>Suppose I have a resource foo which is a statefulset with 3 replicas. Each makes a persistent volume claim.</p> <p>One of the foo pods (foo-1) dies, and a new one starts in its place. Will foo-1 be bound to the same persistent volume that the previous foo-1 had before it died? Will the number of persistent volum...
<p>Yes you can. A PVC is going to create a disk on GCP, and add it as secondary disk to the node in which the pod is running.</p> <p>Upon deletion of an individual pod, K8s is going to re-create the pod on the same node it was running. If it is not possible (say the node no longer exists), the pod will be created on ...
<p>I've got a node pool defined with min instances set to 1 and max instances set to 5, and autoscaling enabled.</p> <p>However it does not seem to be scaling down.</p> <ul> <li>I have cordoned a node.</li> <li>It has been over 12 hours</li> <li>There are no pending pods</li> <li>Removing a node would not reduce the ...
<p>There are a few constraints that could prevent the node from scaling down.</p> <p>You should verify the pods you listed one by one against the <a href="https://github.com/kubernetes/autoscaler/blob/cluster-autoscaler-1.2.2/cluster-autoscaler/FAQ.md#what-types-of-pods-can-prevent-ca-from-removing-a-node" rel="nofoll...
<pre><code>result, err := crdclient.Create(example) if err == nil { fmt.Printf("CREATED: %#v\n", result) } else if apierrors.IsAlreadyExists(err) { fmt.Printf("ALREADY EXISTS: %#v\n", result) } else { panic(err) } // List all Example objects items, err := crdclient.List(meta_v1.ListOptions{}) if err != nil...
<p>I looked at the code, you need to update the Update API in the client.go file with the following code:</p> <pre><code>func (f *crdclient) Update(obj *crd.Example) (*crd.Example, error) { var result crd.Example err := f.cl.Put(). Namespace(f.ns).Resource(f.plural). Name(obj.Name). Bod...
<p>I have a regional cluster set up in <strong>google kubernetes engine (GKE)</strong>. The node group is a single <strong>vm in each region (3 total)</strong>. I have a deployment with <strong>3 replicas minimum</strong> controlled by a HPA. The <strong>nodegroup is configured to be autoscaling</strong> (cluster autos...
<p>Answering myself for visibility.</p> <p>The problem is that the CA never considers moving anything unless all the requirements mentioned in the <a href="https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/FAQ.md" rel="noreferrer">FAQ</a> are met at the same time. So lets say I have 100 nodes wit...
<p>I am experiencing issues when I try to deploy my Django application to Kubernetes cluster. More specifically, when I try to deploy PostgreSQL.</p> <p>Here is what my .YML deployment file looks like:</p> <pre><code>apiVersion: v1 kind: Service metadata: name: postgres-service spec: selector: app: postgres-c...
<p>You can't have your db in <code>/var/lib/postgres/data/whatever</code>.</p> <p>Change that path by <code>/var/lib/postgres/whatever</code> and it will work.</p> <blockquote> <p><strong>17.2.1. Use of Secondary File Systems</strong></p> <p>Many installations create their database clusters on file systems (volumes) ot...
<p>I am trying to build an API, which can send back my pods' resource usage. Looking at the <a href="https://i.stack.imgur.com/9wPbP.png" rel="nofollow noreferrer">resources being used by the pods</a>, I am not able to figure out the go-client API to send the request to. Any help will be very appreciated.</p>
<ol> <li><p>I'm pretty sure the kuberetes-dashboard uses XHR to obtain that data, so you can make the same requests your browser does, provided your <code>serviceAccount</code> has the correct credentials to interrogate the kubernetes-dashboard API</p></li> <li><p>either way, that timeseries data surfaced by kubernetes...
<p>I would like to create a cron job which selects the name kubernetes secrets from a given type (e.g kubernetes.io/tls) older than 29 days.</p> <p>I tried these 2 ways:</p> <p>1 - Using grep:</p> <pre><code>kubectl get secrets --all-namespaces| grep kubernetes.io/tls cicd devkins.infra.mydomain.ninja.tls ...
<p>This is what I use... There is probably better way of doing it, but works for my case (secrets older than 24hrs).</p> <pre><code>kubectl get secrets -o json | jq -r "[.items[] | {name: .metadata.name, startTime: .metadata.creationTimestamp | fromdate } | select(.startTime &lt; (now | . - 86400))]" | jq -r ".[].name...
<p>I'm a beginner on Kubernetes. When I described my node, I saw this at the very bottom:</p> <pre><code>kubectl describe node ip-x-x-x-x.ap-southeast-2.compute.internal ... Allocated resources: (Total limits may be over 100 percent, i.e., overcommitted.) CPU Requests CPU Limits Memory Requests Memory Limits ---...
<p>Every node has limits according to its resources: number of processors or cores, amount of memory. Kubernetes uses this information for distributing Pods across Nodes. </p> <p>Referring to the official documentation:</p> <p><strong>- Meaning of CPU</strong><br> One CPU, in Kubernetes, is equivalent to:<br> - 1 AWS...
<p><strong>What we want to achieve:</strong></p> <p>We would like to use Airflow to manage our machine learning and data pipeline while using Kubernetes to manage the resources and schedule the jobs. What we would like to achieve is for Airflow to orchestrate the workflow (e.g. Various tasks dependencies. Re-run jobs ...
<p>Airflow has both a <a href="https://github.com/apache/incubator-airflow/blob/master/airflow/contrib/executors/kubernetes_executor.py" rel="noreferrer">Kubernetes Executor</a> as well as a <a href="https://github.com/apache/incubator-airflow/blob/master/airflow/contrib/operators/kubernetes_pod_operator.py" rel="noref...
<p>I have an HPC cluster application where I am looking to replace MPI and our internal cluster management software with a combination of Kubernetes and some middleware, most likely ZMQ or RabbitMQ.</p> <p>I'm trying to design how best to do peer discovery on this system using Kubernetes' service discovery. </p> <p>I...
<p>Turns out the best way to do this is with a DNS SRV record:</p> <p><a href="https://kubernetes.io/docs/concepts/services-networking/service/#discovering-services" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/services-networking/service/#discovering-services</a> <a href="https://en.wikipedia.org/wik...
<p>I am working on developing tools to interact with Kubernetes. I have OpenShift setup with the allow all authentication provider. I can log into the web console as I would expect.</p> <p>I have also been able to setup a service account and assign a cluster role binding to the service account user. Despite this, when...
<p><code>oadm policy add-cluster-role-to-user view em7</code> grants to the user named <code>em7</code></p> <p>you need to grant permissions to the service account, e.g. <code>oadm policy add-cluster-role-to-user view system:serviceaccount:default:em7</code></p>
<p>I am trying to deploy the zalenium helm chart in my newly deployed aks Kuberbetes (1.9.6) cluster in Azure. But I don't get it to work. The pod is giving the log below:</p> <blockquote> <p>[bram@xforce zalenium]$ kubectl logs -f zalenium-zalenium-hub-6bbd86ff78-m25t2 Kubernetes service account found. Copying file...
<p>Issue had to do with Azure's AKS and Kubernetes. It has been fixed. See github issue <a href="https://github.com/Azure/AKS/issues/399" rel="nofollow noreferrer">399</a></p>
<p>I can't configure a livenessProbe with attributes for a k8s Deployment, I tried apiVersion: apps/v1beta1, or apps/v1 or apps/v1beta2 or apps/v1beta3.</p> <p>I want to add the attributes :</p> <ul> <li>initialDelaySeconds</li> <li>periodSeconds</li> <li>timeoutSeconds</li> </ul> <p>If I define any of these attribu...
<p>Yes it was the indent level thanks a lot, and it's correct on the documentation so I think this question isn't useful in general sorry</p>
<p>We are using Google Kubernetes Engine on 1.9.6-gke.1, and have a cluster with several nodepools for which we enable auto-scaling because the nodes in them contain attached GPUs (p100s).</p> <p>Sometimes we run jobs overnight via a Kubernetes Pod on a node that was brought up due to a triggered auto-scaling event, a...
<p>There are two logs within Stackdriver Logging that you can check GKE logs. The first one is called "GKE Cluster Operations", and the second is called "Container Logs". </p> <p>The "GKE Cluster Operations" logs will show you all the operations that take place within the cluster such as pod creation, container creati...
<p>I have deployed Kubernetes using the link <a href="https://kubernetes.io/docs/tasks/tools/install-kubeadm/" rel="nofollow noreferrer">Kubernetes official page</a></p> <p>I see that Kubernetes is deployed because in the end i got this</p> <pre><code>Your Kubernetes master has initialized successfully! To start usi...
<p>It looks like your last kubectl config interferes with the previous clusters configurations.</p> <p>It is possible to have settings for <a href="https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/" rel="nofollow noreferrer">several different clusters</a> in one <code>.kub...
<p>I came across Skaffold, trying to streamline local Docker image development. We basically want to be able to quickly iterate on an image and deploy it using an existing stable helm chart version.</p> <p>In the documentation it says:</p> <p><a href="https://github.com/GoogleContainerTools/skaffold#installation" rel...
<p>With skaffold, you don't need any registry if you want to deploy to minikube. By default, it <a href="https://github.com/GoogleContainerTools/skaffold/blob/a0c641b4d626b604e34e765d851a05207b253639/examples/annotated-skaffold.yaml#L60" rel="noreferrer">seamlessly puts</a> the image to minikube without any external re...
<p><strong>The ndots problem</strong></p> <p>I have a Kubernetes cluster (running on openstack) and a separate cluster of VMs running on the same openstack tenancy. I needed to be able to resolve services running in the VM cluster from the kubernetes cluster.</p> <ol> <li>I set up ipvs "loadbalancer"</li> <li>On this...
<p>There are no side effects. You just make one DNS query for a FQDN with is set Ndots:0. The whole ndots is like a secret agent trying to mess up your requests.</p>
<p>How are service accounts supposed to be used? Should we create one service account per container? Is there any concept equivalent to "user group" in order to group service accounts?</p>
<p>Service Accounts are used by Pods to get access to Kubernetes API or Secrets. When a Pod is created, it gets a Service Account. The <code>default</code> Service Account for the same namespace is assigned to a Pod automatically. It can be specified in a description for Pod. Here you can find some examples: <a href="h...
<p>We have multiple development teams who work and deploy their applications on kuberenetes. We use helm to deploy our application on kubernetes.</p> <p>Currently the challenge we are facing with one of our shared clusters. We would like to deploy tiller separate for each team. So they have access to their resources. ...
<blockquote> <p>I would want to deploy tiller which has permission to work with resources exist or need to be created in these namespaces</p> </blockquote> <p>According to <a href="https://kubernetes.io/docs/reference/access-authn-authz/rbac/#rolebinding-and-clusterrolebinding" rel="nofollow noreferrer">the fine man...
<p>Sometimes, I'll have a terminal tab with <code>kubectl exec bash</code> running in it to check on a container or tail a log file. When I shut my laptop, turn on my VPN, or just lose Wi-Fi for a second, that terminal can sometimes freeze and leave me unable to exit it without closing the terminal tab or killing the ...
<p>It is not clear what is the root of the problem causing abnormal hang ups of <a href="https://kubernetes.io/docs/reference/kubectl/overview/" rel="nofollow noreferrer">kubectl</a> exec command.</p> <p>Getting back to your question, you can force to drop the connection and return control of (docker) terminal back to...
<p>If I run <code>systemctl restart kubelet</code> will it impact the other running nodes? Will it stop the cluster? Can you foresee any impact? Any help would be appreciated!</p>
<p>Before answering, small disclaimer: restart is not due to multiple potentially breaking configuration changes to kubelet and kubelet is indeed restarted not crashed due to misconfiguration. Answer is aimed at scenario of simple restart of kubelet (with maybe small and non-breaking configuration change)</p> <blockquo...
<p><strong>What I have</strong></p> <p>I have used Kube secrets for private Docker registry authentication in the <code>default</code> namespace. That works as expected. For example:</p> <pre><code>$ kubectl get secret regsecret NAME TYPE DATA AGE regsecret kubernetes.io/dock...
<p>By design, there is no way to accomplish this. You will need to create the <code>regsecret</code> in the same namespace where your Deployment is.</p> <blockquote> <p><code>ImagePullSecrets</code> is an optional list of references to secrets <strong>in the same namespace</strong> to use for pulling any of t...
<p>I am developing a chart and I had an error in it—incorrectly placed <code>imagePullSecrets</code>. When I tried to install it via</p> <pre><code>helm install ./mychart </code></pre> <p>the misplaced element was simply ignored and I wondered what is wrong.</p> <p>When I did</p> <pre><code>helm template ./mychart ...
<p>You can lint the chart by going <code>helm lint ./mychart</code> which should print the following if an issue is found:</p> <pre><code>$ helm lint ./mychart ==&gt; Linting ./mychart [ERROR] Chart.yaml: version is required [INFO] Chart.yaml: icon is recommended Error: 1 chart(s) linted, 1 chart(s) failed </code></p...
<p>Is it possible to reference a PVC (in namespace-A) from namespace-B. Why I need that? I would like to allow the customer (private cloud) to point their volume through PVC, allowing them full control of the storage. At the Helm install time will ask for PVC information and will be used in the pod spec. </p>
<p>It looks impossible, just because <code>PersistentVolumeClaim</code> is a namespaced object. You can look detailed answer here: <a href="https://stackoverflow.com/a/35366775/9065705">https://stackoverflow.com/a/35366775/9065705</a></p>
<p>I have setup filebeat as a daemonset in kubernetes to forward logs to ES + kibana from docker containers. (by referencing <a href="https://www.elastic.co/guide/en/beats/filebeat/master/running-on-kubernetes.html" rel="nofollow noreferrer">https://www.elastic.co/guide/en/beats/filebeat/master/running-on-kubernetes.h...
<p>Finally able to solve the issue, use Multi-line filter under <code>filebeat.autodiscover:</code></p> <pre><code> filebeat.autodiscover: providers: - type: kubernetes templates: - condition: or: - equals: kubernetes.contain...
<p>I have a kubernetes setup that looks like this:</p> <p>nginx ingress -> load balancer -> nginx app</p> <p>after getting an SSL certificate for <strong>www</strong>.foo.com, I've installed it in my nginx ingress as a secret, and it works as expected - traffic to <code>www.foo.com</code> gets redirected to the <code...
<p>You need to add the certificate for the domain you want to be redirected:</p> <pre><code>apiVersion: extensions/v1beta1 kind: Ingress metadata: name: foo-https-ingress annotations: kubernetes.io/ingress.class: "nginx" nginx.ingress.kubernetes.io/from-to-www-redirect: "true" spec: rules: - host: fo...
<p>I am trying to learn kubernetes, and I have successfully setup a cluster (1-node) on bare-metal, deployed a service and exposed it via ingress.</p> <p>I tried to implement traefik, to get lets encrypt certificates, but I couldn't get it working and while debugging I noticed, my DNS service wasn't working properly (...
<p>Digging into Javier's answer, I found the solution to the problem here: <a href="https://github.com/kubernetes/kubeadm/issues/787" rel="nofollow noreferrer">https://github.com/kubernetes/kubeadm/issues/787</a></p> <p>These were the commands needed to work around the problem:</p> <pre><code>sudo rm /etc/resolv.conf...
<p>What's the best way to store a persistent file in Kubernetes? I have a cert (.pfx) and I want to be passing to the application its path. From the looks of it it can't be stored in secrets. Was thinking about a volume but the question is how do I upload the file to it? And which type of volume to choose? Or is there ...
<p>It's unclear from your question why you came to the conclusion that it can't be stored as a Secret. This is one of the main <a href="https://kubernetes.io/docs/concepts/configuration/secret/#use-cases" rel="noreferrer">use cases</a> for Secrets.</p> <p>Step 1. Create a Secret from your file:</p> <pre><code>kubectl...
<p>My kubernetes version is 1.10.4.</p> <p>I am trying to create a ConfigMap for java keystore files:</p> <pre><code>kubectl create configmap key-config --from-file=server-keystore=/home/ubuntu/ssl/server.keystore.jks --from-file=server-truststore=/home/ubuntu/ssl/server.truststore.jks --from-file=client--truststore=...
<p><code>kubectl describe</code> does not show binary data in ConfigMaps at the moment (kubectl version v1.10.4); also the <code>DATA</code> column of the <code>kubectl get configmap</code> output does not include the binary elements:</p> <pre><code>$ kubectl get cm NAME DATA AGE key-config 0 ...
<p>I understood Ingress can be used when we want to expose multiple service/routes with a single Load Balancer / public IP.</p> <p>Now I want to expose my Nginx server to public. I have two choices</p> <ol> <li>Set <code>service type as LoadBalancer</code> voila I got public IP</li> <li>Use <a href="https://github.co...
<p>There is a difference between <em>ingress rule (ingress)</em> and <em>ingress controller</em>. So, technically, nginx ingress controller and LoadBalancer type service are not comparable. You can compare ingress resource and LoadBalancer type service, which is below.</p> <p><strong>Generally speaking:</strong></p> ...
<p>In most situations, my web applications do not assume /tmp will exist between requests. However certain web application projects write to /tmp, and then read the results in the following request, which <a href="https://www.drupal.org/project/webform/issues/2980276" rel="nofollow noreferrer">can cause issues if a web...
<p>It isn't a good practice to share your /tmp folder between containers, but you can create a persistent volume with read-write-many permission:</p> <pre><code>apiVersion: v1 kind: PersistentVolume metadata: name: pv0003 spec: capacity: storage: 5Gi volumeMode: Filesystem accessModes: - ReadWriteMany ...
<p>If one has an image with a number of different executables, is it possible to have multiple cron entries with different commands that run at different times in the same kubernetes deployment.</p> <p>e.g. For some single container image named "jolly-roger", I want to schedule the following crontab, without having to...
<p>You can:</p> <ul> <li>create a single cronjob resource with exactly one crontab time (like <code>*/30 * * * *</code>) and several containers to run</li> <li>create several cronjob resources using the same container images but different <code>command</code> and <code>args</code> for each job</li> </ul> <p>You can n...
<p><a href="https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/" rel="noreferrer">https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/</a> The docs are not very clear as to what exactly the values represent.</p> <blockquote> <p>the system will try to avoid placing a pod that do...
<p>Although there is a slight difference, I like more Google explanation about what <strong>Node Taints</strong> are, rather then Kubernetes:</p> <p>A node taint lets you mark a node so that the scheduler avoids or prevents using it for certain Pods. A complementary feature, tolerations, lets you designate Pods that c...
<p>followed <a href="https://kubernetes.io/docs/setup/independent/create-cluster-kubeadm/" rel="noreferrer">steps to create single master cluster</a>, i was able to successfully init the master, but when apply i got <strong>forbidden</strong> error, any one experienced the same? thanks!</p> <p>i did the following</p> ...
<p>As soon as your cluster is not yet fully functional, it would be easier to tear it down and recreate from scratch:</p> <h3>Tear down everything:</h3> <pre><code>$&gt; sudo su #&gt; kubeadm reset #&gt; rm -rf $HOME/.kube /etc/kubernetes </code></pre> <h3>Prepare your host (just in case you haven’t done it already...
<p>We are looking into migrating all our company services to Kubernetes. Since it seems to be pretty straight forward to setup I was looking into Azure Kubernetes Service.</p> <p>Out of curiosity and with certain privacy issues in mind, I was wondering if it is possible to add self-hosted nodes to the Azure Kubernetes...
<p>No. All nodes in the cluster must run in Azure and are managed by the AKS service, though they reside in your subscription.</p>
<p>I have created the docker registry secret using below command</p> <pre><code>kubectl create secret docker-registry regcred --docker-server=https://dockerreleaselocal.jfrog.io --docker-username=user --docker-password='password' --docker-email=email </code></pre> <p>Below is the Kubernetes yaml code for pulling the ...
<p>Above issue was regarding ACL of the user. A user should have annotate permission for docker registry. If he has annotate permission, the properties will be generated automatically using the manifest file. </p>
<p>We are noticing restarts of our Kubernetes pods (Google Container Engine) whenever JVM's garbage collection duration is a little long.</p> <p>Specifically speaking, anytime, it seems to cross ~20 seconds, it causes a restart of the pod.</p> <p>1) The JVM is not out of heap memory. It's still less than 20% of alloc...
<p>Found it. </p> <p>I had to adjust timeoutSeconds from default of 1 second to 5 seconds in addition to setting periodSeconds to 12, to make it wait for ~60 seconds before flagging a pod as unresponsive.</p>
<p>I have been reading about <a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#define-readiness-probes" rel="nofollow noreferrer">liveness and readiness probes in kubernetes</a> and I would like to use them to check and see if a cluster has come alive.</p> <p>The qu...
<p>You need to change <code>.spec.podManagementPolicy</code> for a <code>StatefulSet</code> from <code>OrderedReady</code> to <code>Parallel</code> policy. </p> <p>This way K8S will start all your pods in parallel and won't wait for probes.</p> <p>From <a href="https://kubernetes.io/docs/reference/generated/kubernete...
<p>I am deploying a spring boot application and is considering various options for externalize configuration. I came to know below options.</p> <pre><code>1) ConfigMap 2) properties/yaml file in Git and a process in container to watch for changes and restart the application with new properties if there are any changes...
<p>Both are good options to handle configuration.</p> <p>Git approach has the advantage of versioned configuration but you'll need an extra container to be coded and maintained.</p> <p>For me configmap is the best option. As it is a Kubernetes native object you don't need a git repo nor a git container, it is just st...
<p>I'm looking for a way to tell (from within a script) when a Kubernetes Job has completed. I want to then get the logs out of the containers and perform cleanup. </p> <p>What would be a good way to do this? Would the best way be to run <code>kubectl describe job &lt;job_name&gt;</code> and grep for <code>1 Succeeded...
<p>Since version 1.11, you can do:</p> <pre><code>kubectl wait --for=condition=complete job/myjob </code></pre> <p>and you can also set a timeout:</p> <pre><code>kubectl wait --for=condition=complete --timeout=30s job/myjob </code></pre>
<p>The Kubernetes <a href="https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/" rel="nofollow noreferrer">documentation</a> mentions that a <code>CronJob</code> supports the use case of:</p> <blockquote> <p>Once at a specified point in time</p> </blockquote> <p>But, I don't see any examples of how this...
<p>According to <a href="https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/" rel="nofollow noreferrer">documentation</a>, CronJob uses the common <a href="https://en.wikipedia.org/wiki/Cron" rel="nofollow noreferrer">Cron</a> format of schedule:</p> <p>Here are some examples:</p> <pre><code> schedu...
<p>I'd like to know whether I'm able to propagate environment variables from a file.</p> <p>Guess I have a file like this:</p> <pre><code>ENV_VARIABLE_USERNAME=username ENV_VARIABLE_PASSWORD=password </code></pre> <p>I'd like when I pod kicks off, this content file is propagated as environment variables.</p> <p>Is ...
<p>Generally speaking, for environment variables, you would do it through a configMap. But as this is a username and password (sensitive information), you can do it through a secret.</p> <p>For example, given the Pod (redis, for this example) and the Secret below:</p> <pre><code>apiVersion: v1 kind: Secret metadata: ...
<p>I have a Kubernetes v1.9.3 (no OpenShift) cluster I'd like to manage with ManageIQ (gaprindashvili-3 running as a Docker container).</p> <p>I prepared the k8s cluster to interact with ManageIQ following <a href="http://manageiq.org/docs/guides/providers/kubernetes" rel="nofollow noreferrer">these instructions</a>. ...
<p>For the <code>ClusterRole</code> to take effect it must be bound to the group <code>management-infra</code> or user <code>management-admin</code>.</p> <p>Example of creating group binding:</p> <pre><code>kind: ClusterRoleBinding apiVersion: rbac.authorization.k8s.io/v1 metadata: name: read-cluster-state subjects...
<p>Problem:</p> <pre><code>/ # ping 8.8.8.8 PING 8.8.8.8 (8.8.8.8): 56 data bytes ping: sendto: Network unreachable </code></pre> <p>Example container <code>ifconfig</code>: </p> <pre><code>eth0 Link encap:Ethernet HWaddr F2:3D:87:30:39:B8 inet addr:10.2.8.64 Bcast:0.0.0.0 Mask:255.255.255.0 inet...
<p>It is possible if you set a config map with upstreamNameServers.</p> <p>Example:</p> <pre><code>apiVersion: v1 kind: ConfigMap metadata: name: kube-dns namespace: kube-system data: upstreamNameservers: | ["8.8.8.8", "8.8.8.4"] </code></pre> <p>And in you Deployment definition add:</p> <pre><code>dnsPol...
<p><strong>Summary</strong></p> <p>I have a flask application deployed to Kubernetes with python 2.7.12, Flask 0.12.2 and using requests library. I'm getting a SSLError while using requests.session to send a POST Request inside the container. When using requests sessions to connect to a https url , requests throws a S...
<p>The problem may be in the Alpine Docker image that lacks CA certificates. On your laptop code works as it uses CA certs from you local workstation. I would think that running Docker image locally will fail too - so the problem is not k8s.</p> <p>Try to add the following line to the Dockerfile:</p> <pre><code>RUN a...
<p>We have multiple Namespaces in our cluster. Admin will have access to all the Namespaces by means of ClusterRole. But, user will be given access to the corresponding namespaces.</p> <p>Say, user A is given access to namespace B,C &amp; D.</p> <p>So user A deploys dashboard in Namespace B with service account and Rol...
<p>In the current version of <a href="https://kubernetes.io" rel="nofollow noreferrer">Kubernetes</a>, it is possible to manage different namespaces by different users. You need to realize how the <a href="https://kubernetes.io/docs/reference/access-authn-authz/rbac/" rel="nofollow noreferrer">RBAC</a> works and how to...
<p>In Kubernetes, is it possible to use a Configmap for the value of an annotation? The reason I want to do this is to reuse an IP whitelist across multiple ingresses. Alternatively, is there another way to approach this problem?</p>
<p>Unfortunately, no feature does it in Kubernetes. But as <a href="https://stackoverflow.com/users/4501268/iomv">iomv</a> wrote, you could try to use <a href="https://docs.helm.sh/using_helm/#quickstart-guide" rel="nofollow noreferrer">helm.</a></p> <p>Helm allows you to use variables in your charts, for example:</p>...
<p>I have a problem about the images returned via the apps running behind the nginx ingress controller. They always returns 200 instead of an expected 304 once visited.</p> <p>Digging around, i've found out about the ability to add specific blocks within the servers; so added the following under metadata > annotations...
<p>In case somebody else stumbles upon this (probably be me in the future), the annotation is <code>nginx.ingress.kubernetes.io/server-snippet</code>.</p>
<p>I need to access a service from my cluster on GKE outside of it. This service restricts access IP allowing just one IP. So, I have to set a NAT or something like that, but I don't really sure that is the right solution to set an external gateway/NAT on my GKE cluster. Can you help me, please?</p>
<p>You can use <a href="https://github.com/doitintl/kubeIP" rel="nofollow noreferrer">kubeip</a> in order to assign IP addresses <a href="https://blog.doit-intl.com/kubeip-automatically-assign-external-static-ips-to-your-gke-nodes-for-easier-whitelisting-without-2068eb9c14cd" rel="nofollow noreferrer">blog post</a></p>...
<ol> <li>eg. I have 2 pods, they were called <strong>nginx-111-xxx</strong>, <strong>nginx-111-yyy</strong>, but there is <strong>something wrong in nginx-111-xxx</strong>, I need to create a new pod to replace it because the demands acquire you to <strong>delete nginx-111-xxx</strong>, then a NEW pods <strong>nginx-11...
<p>It's not possible to change the name of a running pod, as the API will not accept this.</p> <p>The random pod names come in fact you are using Kubernetes deployments, which are the default or most commonly used ways to run pods on Kubernetes. But there are different ways to schedule pods, beside of that.</p> <p>Howe...
<p>How to I generate a PDF version of the Kubernetes docs at <a href="http://kubernetes.io/v1.0/" rel="noreferrer">http://kubernetes.io/v1.0/</a>? Or, how do I get a printout of its docs at all?</p>
<p>Here is a project that tries to do that: <a href="https://github.com/dohsimpson/kubernetes-doc-pdf" rel="noreferrer">kubernetes pdf doc</a></p>
<p>We are attempting to make several private Kubernetes clusters. We can find limited documentation on specific settings for the private cluster, therefore we are running into issues related to the subnetwork IP ranges. </p> <p>Say we have 3 clusters: We set the Master Address Range to 172.16.0.0/28, 172.16.0.16/28 an...
<p>This cluster has VPC-native (alias IP) enabled, which use 2 secondary ranges per cluster.</p> <p>See <a href="https://cloud.google.com/kubernetes-engine/docs/how-to/alias-ips#secondary_ranges" rel="nofollow noreferrer">https://cloud.google.com/kubernetes-engine/docs/how-to/alias-ips#secondary_ranges</a></p> <p>Acc...
<p>This is my ingress configuration:</p> <pre><code>apiVersion: extensions/v1beta1 kind: Ingress metadata: name: public-ingress namespace: platform annotations: kubernetes.io/ingress.global-static-ip-name: "app-staging-ip" spec: backend: serviceName: app-central servicePort: 8080 </code></pre> <p>...
<p>Because your IP is regional. Needs to be global. Create it with:</p> <pre><code>gcloud compute addresses create app-staging-ip --global </code></pre>
<p>I installed minikube on my mac and created deployment and a service for my nodejs app. I tested that everything is working by getting the URL of my service using the following command:</p> <pre><code>minikube service my-nodejs-app --url </code></pre> <p>and then I run this URL in the browser and got results. The pro...
<p>You can use <code>"port forward a service"</code>. Assuming:</p> <ul> <li>Your local machine IP: <code>166.6.6.6</code> (which hold minikube) </li> <li>Your minikube IP: <code>192.168.99.100</code> (check the real IP with command <code>$minikube ip</code>) </li> <li>The nodePort of your service 'my-nodejs-app': <co...
<p>Suppose I have a service containing two pods. One of the pods is an HTTP server, and the other pod needs to hit a REST endpoint on this pod. Is there a hostname that the second pod can use to address the first pod?</p>
<p>I'm assuming when you say "service" you aren't referring to the Kubernetes lexicon of a <code>Service</code> object, otherwise your two Pods in the <code>Service</code> would be identical, so let's start by teasing out what a "Service" means in Kubernetes land. </p> <p>You will have to create an additional <a href=...
<p>Let's say I have a database with schema of v1, and an application which is tightly coupled to that schema of v1. i.e. SQLException is thrown if the records in the database don't match the entity classes.</p> <p>How should I deploy a change which alters the database schema, and deploys the application which having a...
<p>This problem actually isn't specific to kubernetes, it happens in any system with more than one server -- kubernetes just makes it more front-and-center because of how automatic the rollover is. The words "tightly coupled" in your question are a dead giveaway of the <em>real</em> problem here.</p> <p>That said, the...
<p>I am trying to mount a <a href="https://kubernetes.io/docs/concepts/storage/volumes/#hostpath" rel="nofollow noreferrer">hostPath volume</a> into a Kubernetes Pod. An example of a <code>hostPath</code> volume specification is shown below, which is taken from the docs. I am deploying to hosts that are running RHEL ...
<p>You can assign SELinux labels using <code>seLinuxOptions</code>:</p> <pre><code>apiVersion: v1 kind: Pod metadata: name: test-pd spec: containers: - image: k8s.gcr.io/test-webserver name: test-container volumeMounts: - mountPath: /test-pd name: test-volume securityContext: seLinuxOp...
<p>I'm having trouble connecting to the kubernetes python client even though I'm following the examples <a href="https://github.com/kubernetes-client/python/blob/master/examples/example1.py" rel="noreferrer">here</a> in the api. </p> <p>Basically this line can't connect to the kubernetes client: </p> <pre><code>confi...
<p>You don't want <code>config.load_kube_config()</code>, you want <a href="https://github.com/kubernetes-client/python/blob/6.0.0/examples/in_cluster_config.py#L21" rel="noreferrer"><code>config.load_incluster_config()</code></a></p> <p>If you need to distinguish between your setup and when it's running in a <code>Po...
<p>I have an application set up like this:</p> <p><a href="https://i.stack.imgur.com/WDQeq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WDQeq.png" alt="enter image description here"></a></p> <p>There is a server, with a reverseproxy/load balancer that acts as the HTTPS termination (this is the o...
<p>It will be lost. I think you need to extract it in the reverse proxy (i.e. Nginx) and pass it in as a HTTP header if you really must. See for example <a href="https://serverfault.com/questions/788895/nginx-reverse-proxy-pass-through-client-certificate">https://serverfault.com/questions/788895/nginx-reverse-proxy-pas...
<p><br> I was installing Google cloud platform on my centos 7 machine. I am reading the commands from a book and it says that I should create a Project_ID, so I put proj1, then it says that as a verification step I could type: <br><br></p> <pre><code>gcloud alpha projects list </code></pre> <p>To check the projects I...
<p>Errata... Yes... I didnt double check, and there was a missing command, prior setting up the project, the command is:</p> <pre><code>gcloud config list project </code></pre> <p>and then</p> <pre><code>gcloud config set project PROJECT_ID </code></pre>
<p>I have a Docker image with the CMD to run a Java application.</p> <p>This application is being deployed to container into Kubernetes. Since, I am deploying it as a Docker image, I was expecting it as running as a Docker process. So, I just logged into the pods and was trying &quot;<strong>docker ps</strong>&quot;.</...
<p>As others stated, <strong>Kubernetes uses docker internally to deploy the containers</strong>. To explain in detail consider the cluster which has 4 nodes, 1 master and 3 slaves.</p> <pre><code>$ kubectl get nodes NAME STATUS ROLES AGE VERSION ******.mylabserver.com Ready ...
<p>i try to deploy a container but unfortunately i have an error when i try to execute <strong>kubectl apply -f *.yaml</strong></p> <p>the error is : </p> <blockquote> <p>error validating data: ValidationError(Pod.spec.containers[1]): unknown field "persistentVolumeClaim" in io.k8s.api.core.v1.Container;</p> </bl...
<p>The reason you're seeing that error is due to you specifying a <code>persistentVolumeClaim</code> under your pod spec's container specifications. As you can see from the auto generated docs here: <a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.10/#container-v1-core" rel="nofollow noreferrer...
<p>I would like to pass in some of the values in kubernetes yaml files during runtime like reading from config/properties file. </p> <p>what is the best way to do that?</p> <p>In the below example, I do not want to hardcode the port value, instead read the port number from config file.</p> <p>Ex:</p> <pre><code>log...
<p>This sounds like a perfect use case for Helm (www.helm.sh).</p> <p>Helm Charts helps you define, install, and upgrade Kubernetes applications. You can use a pre-defined chart (like Nginx, etc) or create your own chart.</p> <p>Charts are structured like:</p> <pre><code>mychart/ Chart.yaml values.yaml charts/...
<p>I am trying to understand the K8s gpu practices better, and implementing a small K8s GPU cluster which is suppose to work like below.</p> <p>This going to be little long explanation, but I hope it will help to have many questions at once place to understand GPU practices better in Kubernetes.</p> <h2>Application R...
<p>Both designs are supported in 1.10. I view design 2 as a special case of 1. You don't necessarily need to have 1 GPU per node. In case your pod needs more GPUs and memory, you have to have multiple GPUs per node, as you mentioned in question (4). I'd go with 1 unless there's a reason not to.</p> <p>I think the best...
<p>I'm trying to create a number of pods from a yaml loop in helm. if I run with <code>--debug --dry-run</code> the output matches my expectations, but when I actually deploy to to a cluster, only the last iteration of the loop is present.</p> <p>some yaml for you: </p> <pre><code>{{ if .Values.componentTests }} {{- ...
<p>found it! </p> <p>so apparently, helm uses <code>---</code> as a separator between specifications of pods/services/whatHaveYou.</p> <p>specifying the same fields multiple times in a single chart is valid, it will use the last specified value for for any given field. To avoid overwriting values and instead have mul...
<p>I created a Kubernetes cluster for a single-master multi-node cluster using kubeadm following the official kubernetes guide:</p> <p><a href="https://kubernetes.io/docs/setup/independent/create-cluster-kubeadm/" rel="nofollow noreferrer">Kubernetes cluster</a></p> <p>I currently connect my laptop to the cluster via...
<p>It's suitable to use Kubernetes <code>serviceAccount</code> and instruct your Jenkins deployment to use that account (with a bound Role):</p> <pre><code>--- apiVersion: v1 kind: ServiceAccount metadata: name: jenkins --- kind: Role apiVersion: rbac.authorization.k8s.io/v1beta1 metadata: name: jenkins rules: - a...
<p>I can delete all jobs inside a custer running</p> <pre><code>kubectl delete jobs --all </code></pre> <p>However, jobs are deleted one after another which is pretty slow (for ~200 jobs I had the time to write this question and it was not even done).</p> <p>Is there a faster approach ?</p>
<p>It's a little easier to setup an alias for this bash command:</p> <pre><code>kubectl delete jobs `kubectl get jobs -o custom-columns=:.metadata.name` </code></pre>
<p>I have a nested maven project structure, several of the Maven Artefacts contains also Kubernetes configurations, when I do the complete deployment of the projects, I want to combine all Kubernetes configuration and run it centrally.</p> <p>It is something like Spring Application Context 'import' statements, of cour...
<p>There is no option to use something like include in Kubernetes right now. Maybe in the future, they will add such an option.</p> <p>You are right that you can create one big file and use '---' delimiters for each new configuration.</p> <p>However, you also have another option: use -f key, for example:</p> <pre><c...
<p>In <a href="https://github.com/kubernetes-client/java" rel="nofollow noreferrer">Kubernetes-client Java api</a>, I can get a count of available and total deployed pod instances for a given app using this way:</p> <pre><code>ApiClient defaultClient = Configuration.getDefaultApiClient(); AppsV1beta1Api apiInstance = ...
<p>I don’t know how to do this for all namespaces but for one namespace it will look like:</p> <pre><code>curl -k -s 'https://prometheus-k8s/api/v1/query?query=(sum(kube_deployment_spec_replicas%7Bnamespace%3D%22default%22%7D)%20without%20(deployment%2C%20instance%2C%20pod))%20-%20(sum(kube_deployment_status_replicas_...
<p>Is there any policy or a way that enable us to auto delete a persistent volume claim when a kubernetes-job (using that claim) gets completed.</p> <p>FYI: i am creating persistent volume claim using delete policy i.e. on claim deletion the associated persistent volume gets deleted too which is my intended behavior.<...
<p>There is no such functionality in Kubernetes to delete a Persistent Volume Claim after a Job has been completed.</p> <p>One of the ways is to use Cron Job with simple <code>busybox</code> container running bash script, which checks and deletes unused Persistent Volume Claims.</p> <p>It is not recommended to use cu...
<p>I need to get access to current namespace. I've look up <code>KUBERNETES_NAMESPACE</code> and <code>OPENSHIFT_NAMESPACE</code> but they are unset.</p> <pre><code>$ oc rsh wsec-15-t6xj4 $ env | grep KUBERNETES KUBERNETES_SERVICE_PORT=443 KUBERNETES_PORT=tcp://172.30.0.1:443 KUBERNETES_PORT_53_TCP_ADDR=172.30.0.1 KU...
<p>OpenShift are using Project instead Namespace.</p> <p><a href="https://docs.openshift.com/container-platform/3.9/architecture/core_concepts/projects_and_users.html#namespaces" rel="nofollow noreferrer">https://docs.openshift.com/container-platform/3.9/architecture/core_concepts/projects_and_users.html#namespaces</a...
<p>I have to communicate between two PODs in minikube which are exposed in two different ports but are in a single node.</p> <p>For example:</p> <ul> <li>POD A uses 8080 port and which is the landing page. </li> <li>From POD A we access POD B via hyperlink which uses 8761 port. </li> </ul> <p>Now, in kubernetes it a...
<blockquote> <p>I have to communicate between two PODs in minikube which are exposed in two different ports but are in a single node.</p> </blockquote> <p>Based on the facts that you want inter-pod communication and that pods reside on the same node, you could have several (rather questionable and fragile) approache...
<p>I need cluster-id using kubectl command.</p> <pre><code>root@vagrant-xenial64:~# kubectl get cm cluster-info -n kube-system -o jsonpath='{.data.cluster-config\.json}' { "cluster_id": "xxx", "cluster_name": "prod-yyy-mmm", "cluster_type": "rrr", "cluster_pay_tier": "vvv", "datacenter": "cse", "account_id...
<p>Your <code>ConfigMap</code> resource <code>data</code>-field contains a string which are interpreted as-is when you run <code>jsonpath</code> to select it via <code>'{.data.cluster-config\.json}'</code>. What i mean is that the shell you use will print it as JSON at <code>stdout</code> although it's stored different...
<p>I have a newbie question about Docker and Kubernetes.</p> <p>For example I have three PHP services in different containers. Nginx and php-fpm are in different containers too for each PHP service (1 process = 1 container).</p> <p>Each PHP service should know the DNS name of the other PHP services in the cluster - h...
<p>Kubernetes services create a DNS record that resolves to an IP. When you communicate with this IP the request reaches one of the pods the service is targeted on.</p> <p>For example, if you have the following services: svc1, svc2 and svc3 svc1 should be a resolvable hostname that directs the traffic to one of svc1's...
<p>Any idea why I keep getting this annoying and unhelpful error code/description?</p> <pre><code>Failed to pull image myapidemodocker.azurecr.io/apidemo:v4.0: rpc error: code = Unknown desc = unknown blob </code></pre> <p>I thought of incorrect secret and followed this documentation from Microsoft with no success! [...
<p>I was able to resolve the issue. It had nothing to do with error message! The actual problem was, I was trying to use Windows Container image and Kubernetes in Azure only support Linux Container images.</p> <p>This are the actions I had to do:</p> <ul> <li>Configured Ubuntu (<a href="https://tutorials.ubuntu.com/t...
<p>I have a directory within container A that I would like to share with container B. </p> <p>For example I have a directory <code>/dataabc</code> on container A.</p> <p>I've tried using a shared <code>hostPath</code> volume, however as this is empty when mounted - it makes the existing files non accessible. (<code>/...
<p>Big thanks to @graham, I could reuse the existing container with just this minor modification to the pod config:</p> <pre><code> initContainers: - args: - cp -r /var/www / &amp;&amp; ls -altr /www/ command: - /bin/sh - -c image: example imagePullPolicy: Always name: example-init v...
<p>All system services in Kubernetes are deployed to a namespace, usually called <code>kube-system</code>. Where does that come from? What if I would like to change that to another namespace?</p>
<blockquote> <p>All system services in Kubernetes are deployed to a namespace, usually called kube-system. Where does that come from?</p> </blockquote> <p>As noted in <a href="https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/" rel="nofollow noreferrer">the nice documentation</a> there are th...