Question stringlengths 65 39.6k | QuestionAuthor stringlengths 3 30 ⌀ | Answer stringlengths 38 29.1k | AnswerAuthor stringlengths 3 30 ⌀ |
|---|---|---|---|
<p>Is there a way to query from an API the resources under <code>Kubernetes Engine > Services & Ingress</code> in the GCloud console ?</p>
| cyberhippo | <p>It's a good question. The answer is slightly complicated.</p>
<p>Essentially, IIUC, you want to list the Kubernetes services and ingresses for your cluster(s). This functionality is provided by Kubernetes' API server rather than Kubernetes Engine itself.</p>
<p>So, you can do this various ways but, commonly (using t... | DazWilkin |
<p>I create my docker (python flask).</p>
<p>How can I calculate what is the limit to put for memory and CPU?</p>
<p>Do we have some tools that run performance tests on docker with different limitation and then advise what is the best limitation numbers to put?</p>
| Shurik | <p>With an application already running inside of a container, you can use <code>docker stats</code> to see the current utilization of CPU and memory. While there it little harm in setting CPU limits too low (it will just slow down the app, but it will still run), be careful to keep memory limits above the worst case sc... | BMitch |
<p>I have multiple files in s3 bucket which I need to copy to one of the running Kubernetes pods under /tmp path .
Need any reliable command or try and tested way to do the same.</p>
<p>Let's say my bucket name "learning" and pod name is "test-5c7cd9c-l6qng"</p>
| me25 | <p>AWS CLI commands "<a href="https://docs.aws.amazon.com/cli/latest/reference/s3api/get-object.html" rel="nofollow noreferrer">aws s3api get-object</a>" or "<a href="https://docs.aws.amazon.com/cli/latest/reference/s3/cp.html" rel="nofollow noreferrer">aws s3 cp</a>" can be used to copy the data onto the Pod from S3. ... | Praveen Sripati |
<p>I've a working ValidatingWebhookConfiguration and have been creating|approving CSRs with <code>certificates.k8s.io/v1beta</code>.</p>
<p>I upgraded (MicroK8s) from 1.18 to 1.20 and received a warning that <code>certificates.k8s.io/v1beta</code> is deprecated 1.19+ and thought I'd try (without success) upgrading to <... | DazWilkin | <p><strong>Update</strong> Switched to <a href="https://cert-manager.io" rel="nofollow noreferrer">cert-manager</a> and everything working <a href="https://pretired.dazwilkin.com/posts/210108/" rel="nofollow noreferrer">well</a></p>
<p>I got it working but I'm unsure why what I'm now doing is correct.</p>
<p>And the <c... | DazWilkin |
<p>I'm looking into using Skaffold.dev to improve my development experience with Kubernetes.</p>
<p>I've created a default .NET API project and it's autogenerated my docker file:</p>
<pre><code>#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster deb... | penguinflip | <p>In Skaffold, the artifact <code>context</code> (sometimes called the <em>workspace</em>) is the working directory when building the artifact. For Docker-based artifacts (the default artifact type), the artifact context is the root of the Docker build context and the <code>Dockerfile</code> in the root of the artifa... | Brian de Alwis |
<p>What is a recommended way to have the <code>gcloud</code> available from <strong>within</strong> a running App Engine web application?</p>
<p><strong>Background:</strong><br />
The <a href="https://github.com/kubernetes-client/python" rel="nofollow noreferrer">Kubernetes Python Client</a> is using <code>subprocess</... | samuirai | <p>IIUC the Python client for Kubernetes requires a Kubernetes config and you're using <code>gcloud container clusters get-credentials</code> to automatically create the config; The Python client for Kubernetes does not require <code>gcloud</code>.</p>
<p>I recommend a different approach that uses Google's API Client L... | DazWilkin |
<p>We have a lot of big files (~ gigabytes) in our Google bucket. I would like to process these files and generate new ones. To be specific, these are JSON files, from which I want to extract one field and join some files into one.</p>
<p>I could write some scripts running as pods in Kubernetes, which would connect to... | Vojtěch | <p>Smells like a Big Data problem.</p>
<p>Use Big Data softwares like <a href="http://spark.apache.org/" rel="nofollow noreferrer">Apache Spark</a> for the processing of the huge files. Since, the data is there in the Google Cloud, would recommend <a href="https://cloud.google.com/dataproc/" rel="nofollow noreferrer">... | Praveen Sripati |
<p>Apologies if this is a duplicate, I haven't found a solution in similar questions.
I'm trying to upload a docker image to Google Kubernetes Engine.
I've did it successfully before, but I can't seem to find my luck this time around.</p>
<p>I have Google SDK set up locally with kubectl and my Google Account, which is ... | Niels Uitterdijk | <p>It does take several steps and the blog post you referenced appears to have them correctly. So, I suspect your error is in one of the steps.</p>
<p>Couple of things:</p>
<ul>
<li><p>The error message says <code>Failed to pull image "gcr.io/{project id}/hello-app:v1"</code>. Did you edit the error message t... | DazWilkin |
<p>I wanted to know is it possible to have a job in Kubernetes that will run every hour, and will delete certain pods. I need this as a temporary
stop gap to fix an issue.</p>
| user1555190 | <p>Use a CronJob (<a href="https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/" rel="nofollow noreferrer">1</a>, <a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.12/#cronjob-v1beta1-batch" rel="nofollow noreferrer">2</a>) to run the Job every hour.</p>
<p>K8S API can be access... | Praveen Sripati |
<p>So, I have a specific chain of kubernetes and bash commands that I have to execute on gcloud, I'd like to know if there is any way to execute those commands automatically via scripting, without the need of actually having to open and interact with gcloud CLI. Maybe using a npm package but i don't know if there is a ... | Isaac de Souza | <p>Please provide a little more detail as to what it is you're trying to automate as this will help guide recommendations.</p>
<p>There are several challenges automating subprocesses (e.g. invoking bash and it running <code>gcloud</code>) from within another program. High among these is that shell-scripting doesn't pro... | DazWilkin |
<p>For my project I need a config file to connect my program to a database. Instead of writing the config data(for example username and password) hard coded in a document I want to save it as secure environment variables in kubernetes.</p>
<p>I programmed my application with python. The python application runs success... | William Sharlaag | <p>Th following works and should prove this to you:</p>
<h3>1. Base64 encode e.g. username|password:</h3>
<pre class="lang-sh prettyprint-override"><code>U=$(echo -n "freddie" | base64)
P=$(echo -n "fridays" | base64)
</code></pre>
<p><strong>NB</strong> The host's environment variables are <code>U</code> and <code>... | DazWilkin |
<p>I want to execute script before I run my container</p>
<p>If I execute script in container like that</p>
<pre><code> containers:
- name: myservice
image: myservice.azurecr.io/myservice:1.0.6019912
volumeMounts:
- name: secrets-store-inline
mountPath: "/mnt/... | Vladimir Bodurov | <p>A common way to do this is too use <a href="https://kubernetes.io/docs/concepts/workloads/pods/init-containers/" rel="nofollow noreferrer">Init Containers</a> but I'm unsure what you're trying to run before you run the <code>ENTRYPOINT</code>.</p>
<p>You can apply the same volume mounts in the init container(s), if ... | DazWilkin |
<p>I am a scientist who is exploring the use of Dask on Amazon Web Services. I have some experience with Dask, but none with AWS. I have a few large custom task graphs to execute, and a few colleagues who may want to do the same if I can show them how. I believe that I should be using <a href="https://dask.pydata.org... | jkmacc | <h3>Use Helm or Dask-Kubernetes ?</h3>
<p>You can use either. Generally starting with Helm is simpler.</p>
<h3>How to include custom packages</h3>
<p>You can install custom software using pip or conda. They don't need to be on PyPI or the anaconda default channel. You can point pip or conda to other channels. Her... | MRocklin |
<p>I've been experimenting with skaffold with a local minikube installation. It's a nice to be able to develop your project on something that is as close as possible to production.</p>
<p>If I use the <a href="https://github.com/GoogleContainerTools/skaffold/tree/master/examples/getting-started" rel="noreferrer">gettin... | Fouad | <p>The <em>debug</em> functionality deliberately disables Skaffold's <em>file-watching</em>, which rebuilds and redeploys containers on file change. The redeploy causes existing containers to be terminated, which tears down any ongoing debug sessions. It's really disorienting and aggravating to have your carefully-co... | Brian de Alwis |
<p>I have a Google Kubernetes Engine running and I'm trying to deploy a mongo container. Everything works fine except when I try to use the argument "--wiredTigerCacheSizeGB", then the deployment fails because this command is not recognized. I'm using the latest Mongo version (5.0) and I see nothing in the do... | Hugo Sartori | <p>Does it work if you remove the <code>--wiredTigerCacheSizeGB</code> flag?</p>
<p><strike>I would be surprised.</strike></p>
<blockquote>
<p>It does appear to work (see below) but I can't explain why. I am surprised!</p>
</blockquote>
<p>If this is the correct <a href="https://github.com/docker-library/mongo/blob/mas... | DazWilkin |
<p>I have a Kubernetes cluster set up using Kubernetes Engine on GCP. I have also installed Dask using the Helm package manager. My data are stored in a Google Storage bucket on GCP.</p>
<p>Running <code>kubectl get services</code> on my local machine yields the following output</p>
<p><a href="https://i.stack.imgur.... | PollPenn | <p>Yes, if your client and workers share the same software environment then you should be able to connect a client to a remote scheduler using the publicly visible IP.</p>
<pre><code>from dask.distributed import Client
client = Client('REDACTED_EXTERNAL_SCHEDULER_IP')
</code></pre>
| MRocklin |
<p>I develop in local k8s cluster with <code>minikube</code> and <code>skaffold</code>. Using Django and DRF for the API.</p>
<p>I'm working on a number of <code>models.py</code> and one thing that is starting to get annoying is anytime I run a <code>./manage.py</code> command like (<code>showmigrations</code>, <code>m... | cjones | <p>It seems that <code>./manage.py</code> must be recording some state locally, and thus triggering a rebuild. You need to add these state files to your <code>.dockerignore</code>.</p>
<p>Skaffold normally logs at a <em>warning</em> level, which suppresses details of what triggers sync or rebuilds. Run Skaffold with ... | Brian de Alwis |
<p>I'm trying to improve my knowledge in GCP-GKE as a newbie and in the way to do that, I found out a little concept that I don't quite understand yet. In GKE, there is a <strong>Service Account</strong> called <code>service-PROJECT_NUM@container-engine-robot.iam.gserviceaccount.com</code> (where the <code>PROJECT_NUM<... | nxh6991 | <p><a href="https://cloud.google.com/iam/docs/service-accounts" rel="nofollow noreferrer">Service Accounts</a> aka "robots" contrast with user ("human") accounts and represent two forms of Google identity.</p>
<blockquote>
<p><strong>NOTE</strong> Robots was the original name for Service Accounts an... | DazWilkin |
<p>I'd like to set up a dask cluster with a number of different types of workers e.g. normal workers, high-memory workers, GPU workers, ...</p>
<p>As I understand it I can manually create the workers and tag them with <a href="https://distributed.dask.org/en/latest/resources.html#worker-resources" rel="nofollow norefe... | Dave Hirschfeld | <blockquote>
<p>Is this possible now </p>
</blockquote>
<p>As of 2020-02-15 this is not a supported behavior</p>
<blockquote>
<p>or is this something which is on the roadmap (issue I can subscribe to)?</p>
</blockquote>
<p>Dask isn't centrally managed, and so doesn't have a roadmap. I don't know of any issue ab... | MRocklin |
<p>I am new to skaffold, k8s, docker set and I've been having trouble building my application on a cluster locally.</p>
<p>I have a code repository that is trying to pull a private NPM package but when building it loses the .npmrc file or the npm secret.</p>
<pre><code>npm ERR! code E404
npm ERR! 404 Not Found - GET ht... | Gerry Saporito | <p>Building and deploying an image to Kubernetes is at three levels:</p>
<ol>
<li>Your local system where you initiate the building of an image</li>
<li>The Docker build that populates the image and then stores that image somewhere</li>
<li>The Kubernetes cluster that loads and starts running that image</li>
</ol>
<p>D... | Brian de Alwis |
<p>i am trying GCP and GKE google kubernetes engine.
1-)i am create a cluster
2-)i opened cloud shell and used command "kubectl get nodes"</p>
<p>i get this error:
"The connection to the server localhost:8080 was refused - did you specify the right host or port?"</p>
<p>how can i solve. thanks.</p>
| gokhandincel | <p>You must have a local Kubernetes config file that is used by <code>kubectl</code> to access cluster(s).</p>
<p>Conventionally, the config file is called <code>config</code> (YAML) and is found in <code>${HOME}/.kube/config</code>.</p>
<p>Google provides a way to generate a config file (and context) for you. To do th... | DazWilkin |
<p>My code looks something like this</p>
<pre class="lang-py prettyprint-override"><code>def myfunc(param):
# expensive stuff that takes 2-3h
mylist = [...]
client = Client(...)
mgr = DeploymentMgr()
# ... setup stateful set ...
futures = client.map(myfunc, mylist, ..., resources={mgr.hash.upper(): 1})
client.gat... | r0f1 | <p>Dask will balance loads once it has a better understanding of how long the tasks will take. You can give an estimate of task length with the configuration values </p>
<pre class="lang-yaml prettyprint-override"><code>distributed:
scheduler:
default-task-durations:
myfunc: 1hr
</code></pre>
<p>Or, once... | MRocklin |
<p>We are going to provide customers a function by deploying and running a container in customers kubernetes environment. After the job is done, we will clean up the container. Currently, the plan is to use k8s default namespace, but I'm not sure whether it can be a concern for customers. I don't have much experience i... | vcycyv | <p>I would recommend you <strong>not</strong> use (!?) the default namespace for anything <strong>ever</strong>.</p>
<p>The following is more visceral than objective but it's drawn from many years' experience of Kubernetes. In 2016, a now former colleague and I blogged about the use of namespaces:</p>
<p><a href="https... | DazWilkin |
<p>I am trying to make quick tweaks to the compute requests for a large number of deployments rather than having to get a PR approved if it turns out we need to change the numbers slightly. I need to be able to pass just one variable to the yaml file that gets applied.</p>
<p>Example below.</p>
<p>Shell Script:</p>
<pr... | Nathan McKaskle | <p><code>kubectl apply</code> doesn't accept an <code>--env</code> flag (<code>kubectl apply --help</code>).</p>
<p>You have various choices:</p>
<ol>
<li><code>sed</code> -- treats the YAML as a text file</li>
<li><a href="https://github.com/mikefarah/yq" rel="nofollow noreferrer"><code>yq</code></a> -- treats YAML as... | DazWilkin |
<p>Is there a way to make <code>skaffold dev</code> completely skip image building including the initial one? I have a prebuilt image. All I want skaffold to do is deploy the K8s Deployment YAML file and sync local files to it. I couldn't find a working example of how to do this. Closest was <a href="https://github.com... | David Xia | <p>Skaffold's <code>build.local.tryImportMissing: true</code> setting will cause Skaffold to use a tagged image if it already exists. In your example above, Skaffold would look for <code>gcr.io/my-project/my-repo:v0.7.4-182-gb47cd3b5-dirty</code>.</p>
<p>You could combine <code>tryImportMissing</code> with <code>skaff... | Brian de Alwis |
<p>I'm trying to update a kubernetes template that we have so that I can pass in arguments such as <code>--db-config <value></code> when my container starts up.</p>
<p>This is obviously not right b/c there's not getting picked up</p>
<pre><code>...
containers:
- name: {{ .Chart.Name }}
...
args: ["--... | Catfish | <p>Here's an example showing your approach working:</p>
<p>main.go:</p>
<pre><code>package main
import "flag"
import "fmt"
func main() {
db := flag.String("db-config", "default", "some flag")
tk := flag.String("tk-config", "default", "some flag")
flag.Parse()
fmt.Println("db-config:", *db)
f... | DazWilkin |
<p>I'm trying to containerize a python application, where I used the Kubernetes package. My Dockerfile is:</p>
<pre class="lang-bash prettyprint-override"><code>FROM python:3.10.6
ADD App_pod.py .
ADD config.yml ~/.kube/config
RUN pip3 install requests beautifulsoup4
RUN pip3 install kubernetes
RUN apt-get install -y... | Mahmoud Abdelhafez | <p>A couple of issues:</p>
<ul>
<li><code>~</code> has a special meaning on Linux; it is a shortcut to the user's home directory. I think <code>~</code> is not available for the destination path of a Dockerfile <code>ADD</code> (or <code>COPY</code>) command. You should use a specific path instead</li>
<li>It's not adv... | DazWilkin |
<p>I want to drain node on shutdown and uncordon on start, I wrote below unit file but i am getting error (Openshift 3.11 and Kubernetes 1.11.0)</p>
<pre><code>[Unit]
Description=Drain Node at Shutdown
DefaultDependencies=no
Before=shutdown.target reboot.target halt.target
[Service]
Type=oneshot
ExecStart=/bin/sleep 60... | ImranRazaKhan | <p>Following systemd unit is working, in ExecStop %H should be use for HOSTNAME</p>
<pre><code>[Unit]
Description=Drain Node at Shutdown
After=network.target glusterd.service
[Service]
Type=oneshot
Environment="KUBECONFIG=/root/.kube/config"
ExecStart=/bin/true
ExecStop=/usr/bin/kubectl drain %H --ignore-daem... | ImranRazaKhan |
<p>We are having 1000's of pods running for our application. Due to some reason we need to restart 100's of pods.</p>
<p>Is there any way we can do it in kubernetes using kubectl or any other tool. Please advice. It should be pure pod restart.</p>
| mcbss | <p>One way</p>
<pre><code>kubectl scale deploymennt <your-deployment-goes-here> --replicas=0
</code></pre>
<p>and then</p>
<pre><code>kubectl scale deploymennt <your-deployment-goes-here> --replicas=1000
</code></pre>
<p>Another way:</p>
<p>Write a script that:</p>
<ol>
<li>will acquire a list of all active... | Mark Bramnik |
<p>I am trying to install Kubectl but when I type this in the terminal :</p>
<pre><code>kubectl get pods --namespace knative-serving -w
</code></pre>
<p>I got this :</p>
<pre><code>NAME READY STATUS RESTARTS AGE
activator-69b8474d6b-jvzvs 2/2 Running 0 2h
autosca... | Bruce Peter | <p>Please consider the comments above: you have <code>kubectl</code> installed correctly (it's working) and <code>kubectl describe pod/<pod></code> would help...</p>
<p>But, the information you provide appears sufficient for an answer:</p>
<p><code>FailedScheduling</code> because of <code>Insufficient cpu</code... | DazWilkin |
<p>To wait for a certain pod to be completed the command is </p>
<p><code>kubectl wait --for=condition=Ready pod/pod-name</code> </p>
<p>Similarly I want to wait for any one pod in the statefulset to be ready. I tried the command below which did not work,</p>
<p><code>kubectl wait --for=condition=Ready statefulset/s... | agirlwithnoname | <p>I used following and it works for me</p>
<pre><code>kubectl wait -l statefulset.kubernetes.io/pod-name=activemq-0 --for=condition=ready pod --timeout=-1s
</code></pre>
| ImranRazaKhan |
<p>I am evaluating a migration of an application working with docker-compose to Kubernates and came across two solutions: Kompose and compose-on-kubernetes.</p>
<p>I'd like to know their differences in terms of functionality/ease of use to make decision of which one is more suited.</p>
| staticdev | <p>Both product provide a migration path from docker-compose to Kubernetes, but they do it in a slightly different way.</p>
<ul>
<li>Compose on Kubernetes runs within your Kubernetes cluster and allows you to deploy your compose setup unchanged on the Kubernetes cluster.</li>
<li>Kompose translates your docker-compose... | intellectronica |
<p>We wanted to build a Centralized Toggle Server leveraging Spring Cloud Config Server, but I've read a blog/article hinting that Spring Cloud Config is not Suited for Kubernetes Cloud environment (didn't give any reason why). Instead it is recommended to use Spring Kubernetes ConfigMaps for that. </p>
<p>Can some on... | user3495691 | <p>Here are some thoughts, a kind of comparison that that might help to decide:</p>
<p>IMO both can work generally speaking. Maybe you colleague could provide more insights on this (I'm not joking): what if there is something special in your particular environment that prevents Spring Cloud config from being even cons... | Mark Bramnik |
<p>For my project, I have to connect to a postgres Database in Google Cloud Shell using a series of commands:</p>
<p><code> gcloud config set project <project-name></code><br><code> gcloud auth activate-service-account <keyname>@<project-name>.iam.gserviceaccount.com --key-file=<filename>.json</... | Hemendra | <p>Cloud Shell is a Linux instance and default to the Bash shell.</p>
<p><code>BAT</code> commonly refers to Windows|DOS batch files.</p>
<p>On Linux, shell scripts are generally <code>.sh</code>.</p>
<p>Your script needs to be revised in order to pass the commands intended for the <code>kubectl exec</code> command to... | DazWilkin |
<p>To use alert by E-mail in Grafana, we have to set SMTP settings in grafana.ini.</p>
<p>On Ubuntu, we can easily run the grafana-prometheus-k8s stack by command
<code>microk8s enable prometheus</code>
However, how can we feed grafana.ini to grafana running in a k8s pod?</p>
| Meng-Yuan Huang | <p>We can modify grafana k8s deployment manifest by <strong>volumeMounts</strong> to feed grafana.ini on our host to grafana running in a pod.</p>
<p>First, prepare your grafana.ini with SMTP settings. E.g.</p>
<pre><code>[smtp]
enabled = true
host = smtp.gmail.com:465
# Please change user and password to your ones.
us... | Meng-Yuan Huang |
<p>I have Kubernetes running on two nodes and one application deployed on the two nodes (two pods, one per node). </p>
<p>It's a Spring Boot application. It uses OpenFeign for service discoverability. In the app i have a RestController defined and it has a few APIs and an @Autowired @Service which is called from insid... | Oliver Tasevski | <p>Well, I haven't used openfeign, but in my understanding it can loadbalance only REST requests indeed.</p>
<p>If I've got your question right, you say that when the REST controller calls the service component (UserService in this case) the network call is issued and this is undesirable.</p>
<p>In this case, I belie... | Mark Bramnik |
<p>I am trying to get the pod name with highest CPU utilization using kubectl command.
Able to retrieve list using following command but unable to write a jsonpath query to fetch the name of first pod from the output.
Appreciate any help in this regard. Thanks!</p>
<pre><code>kubectl top pod POD_NAME --sort-by=cpu
</co... | haridurgempudi | <p><code>kubectl top</code> doesn't appear to enable <code>--output</code> formatting and so no JSON and thus no JSONPath :-(</p>
<p>You can:</p>
<pre class="lang-sh prettyprint-override"><code>kubectl top pod \
--sort-by=cpu \
--no-headers \
--namespace=${NAMESPACE} \
| head -n 1
</code></pre>
<p>I think it would be u... | DazWilkin |
<p>The k8s documentation <a href="https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning/" rel="nofollow noreferrer">Versions in CustomResourceDefinitions</a> talks about how to upgrade CRD schema and CRD objects from one version to another.</p>
<p>However, what will h... | Owe u. | <p>You've mostly answered your own question.</p>
<p>Custom Resource <strong>Definitions</strong> (CRDs) <strong>define</strong> Kubernetes resource types in the Kubernetes API.</p>
<p>In most schema evolutions, it is developers' responsibility to version such changes correctly. Kubernetes can't challenge the developer ... | DazWilkin |
<p>I'm pretty new to Prometheus and according to my understanding, there are many metrics already available in Prometheus. But I'm not able to see "http_requests_total" which is used in many examples in the list. Do we need to configure anything in order to avail these HTTP metrics?</p>
<p>My requirement is t... | Savitha | <p>The <a href="https://prometheus.io" rel="nofollow noreferrer">documentation</a> is extensive and helpful.</p>
<p>See <a href="https://prometheus.io/docs/prometheus/latest/installation/#using-docker" rel="nofollow noreferrer">installation</a></p>
<p>If you have Docker, you can simply run:</p>
<pre class="lang-sh pret... | DazWilkin |
<p>I need to clean up some Kubernete namespaces(hello_namespace, second,my_namespace1, my_namespace45,my_namespace44 for example and I do it with a jenkins job.
I read with kubectl the namespace I need to clean up and then I want to fire a job to delete it, My code should be something like that</p>
<pre><code> pipe... | Guel135 | <p>I already got it :)</p>
<pre><code> #!groovy
pipeline {
agent { label 'master' }
stages {
stage('Clean up stages') {
steps {
script {
sh '(kubectl get namespace |egrep "namespace[0-9]+"|cut -f1 -d " "|while read i;do echo -n $i";" ; done;)>resu... | Guel135 |
<p>I am doing some tutorials from <a href="https://codelabs.developers.google.com/codelabs/cloud-springboot-kubernetes?continue=https%3A%2F%2Fdevelopers.google.com%2Flearn%2Fpathways%2Fjava-cloud-fundamentals%23codelab-https%3A%2F%2Fcodelabs.developers.google.com%2Fcodelabs%2Fcloud-springboot-kubernetes#5" rel="nofollo... | fascynacja | <p>There are 2 steps that get blurred by <code>gcloud</code> into one.</p>
<p>The <a href="https://cloud.google.com/sdk/gcloud/reference/container/clusters/create" rel="nofollow noreferrer"><code>gcloud container clusters create</code></a> command not only creates the cluster but it also configures <code>kubectl</code>... | DazWilkin |
<p>The REST API requests , <code>GET , POST , PUT</code> etc to Kubernetes API server are request , responses and simple to understand , such as <code>kubectl create <something></code>. I wonder how the API server serves the pod logs when I do <code>kubectl logs -f <pod-name></code> ( and similar operation... | Ijaz Ahmad | <p>My advice is to always check what <code>kubectl</code> does under the cover, and for that use <code>-v=9</code> with your command. It will provide you with full request and responses that are going between the client and the server. </p>
| soltysh |
<p>I have a Kubernetes cluster with a pod running an instance of Open Telemetry Collector.</p>
<p>My .Net app inside Kubernetes exports traces to the Collector instance which in turn exports them to Elastic APM server. This work correctly if I use this config (<a href="https://github.com/open-telemetry/opentelemetry-c... | Absolom | <p>An <a href="https://github.com/open-telemetry/opentelemetry-collector/issues/2469" rel="nofollow noreferrer">issue</a> was entered for OpenTelemetry Collector that would solve my main concerns of using secrets in environment variables.</p>
<p>Until then, the author of the issue suggest environment variable expansion... | Absolom |
<p>I have this workflow where I write some code and a docker image is deployed under <code>latest</code>. Currently, it deploys to my container registry and then I run this <code>kubectl apply file.yaml</code> after the container deploys, but K8s doesn't seem to recognize that it needs to re-pull and rollout a new depl... | Ryan | <p>@daniel-mann is correct to discourage the use of <code>:latest</code>.</p>
<p>Don't read the word 'latest' when you see the tag <code>latest</code>. It's a default tag and it breaks the ability to determine whether the image's content has changed.</p>
<p>A better mechanism is to tag your images by some invariant val... | DazWilkin |
<p>I am trying to find a way to disable <code>--basic-auth-file</code> on my cluster.</p>
<p>Can someone help me?</p>
| Danilo | <p>Based on your comments your are using kops to deploy a cluster. In kops case, you need to add the following lines to disable the --basic-auth-file flag. </p>
<pre><code>kops edit cluster --name <clustername> --state <state_path>
spec:
kubeAPIServer:
disableBasicAuth: true
</code></pre>
<p><em>sp... | Lorant Fecske |
<p>I am using Spark <code>3.1.2</code> and have created a cluster with 4 executors each with 15 cores.</p>
<p>My total number of partitions therefore should be 60, yet only 30 are assigned.</p>
<p>The job starts as follows, requesting 4 executors</p>
<pre><code>21/12/23 23:51:11 DEBUG ExecutorPodsAllocator: Set total e... | DJ180 | <p>Per <a href="https://spark.apache.org/docs/latest/configuration.html#scheduling" rel="nofollow noreferrer">Spark docs</a>, scheduling is controlled by these settings</p>
<blockquote>
<p><code>spark.scheduler.maxRegisteredResourcesWaitingTime</code><br>default=30s<br>
Maximum amount
of time to wait for resources to r... | mazaneicha |
<p>My bash scripts with <code>kubectl</code> sometimes cause trouble when it changes context. After running the script user may accidentally end up make changes in wrong cluster. I would like to probe your wisdom when it comes to handling context in scripts.</p>
<p>Is it possible for the script to save old context and ... | RandomQuests | <p>Generally, I think it's problematic to depend implicitly on global state that may be arbitrarily updated by other processes and users.</p>
<p>Even with multiple configuration files, there's still opacity as to which cluster, user, namespace, context are being used.</p>
<p>For a single user, <code>kubectl</code>'s co... | DazWilkin |
<p>I'm using <code>kubectl run</code> with environment parameters to create temporary docker containers for me (e.g. some forwarding for debugging purposes).
Since several weeks <code>kubectl</code> is complaining about <code>kubectl run</code> being deprecated. Unfortunately I can't find an appropriate replacement.</p... | peez80 | <p>As the author of the problem let me explain a little bit the intention behind this deprecation. Just like Brendan explains in <a href="https://stackoverflow.com/a/52902113">his answer</a>, <code>kubectl run</code> per se is not being deprecated, only all the generators, except for the one that creates a Pod for you.... | soltysh |
<p>I'm looking for more detailed guidance / other people's experience of using Npgsql in production with Pgbouncer.</p>
<p>Basically we have the following setup using GKE and Google Cloud SQL:</p>
<p><a href="https://i.stack.imgur.com/CeOGy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CeOGy.png"... | Kieran Benton | <p>You are generally on the right track and your analysis seems accurate. Some comments:</p>
<p>Option 2 (turning out keepalives) will help remove idle connections in Npgsql's pool which have been broken. As you've written your application will still some failures (as some bad idle connections may not be removed in ti... | Shay Rojansky |
<p>i have a lab environment with a bind server. The server manages the domain "lab.local" DNS Dynamic Update are configured. The lab client (windows and linux) are using the DNS server.</p>
<p>Now i would like do use a kubernetes cluster in our lab. Can i use the bind server with the zone "lab.local" with kubernetes? ... | DanMar | <p>Once the nginx Pod has been created, it will have a internal IP by default, not addressable from your lab network (only other pods can access it).</p>
<p>To access it from the lab network, expose it as a Service with type as <a href="https://kubernetes.io/docs/concepts/services-networking/service/#nodeport" rel="no... | Praveen Sripati |
<p>I am working on a java service that basically creates files in a network file system to store data. It runs in a k8s cluster in a Ubuntu 18.04 LTS.
When we began to limit the memory in kubernetes (limits: memory: 3Gi), the pods began to be OOMKilled by kubernetes.</p>
<p>At the beginning we thought it was a leak of... | Pablo Hadziatanasiu | <p>Thanks for all this info, it was very useful!</p>
<p>On my app, I solved this by creating a new side container that runs a cron job, every 5 minutes with the following command:</p>
<pre><code>echo 3 > /proc/sys/vm/drop_caches
</code></pre>
<p>(note that you need the side container to run in privileged mode)</p... | Cyrille99 |
<p>I’m k8s beginner, and struggling with below error.</p>
<pre><code>E0117 18:24:47.596238 53015 portforward.go:400]
an error occurred forwarding 9999 -> 80: error forwarding port 80 to pod XXX,
uid : exit status 1: 2020/01/17 09:24:47 socat[840136] E connect(5, AF=2 127.0.0.1:80, 16): Connection refused
</code><... | Taruya | <p>The error is telling you, that there's nothing listening to port <strong>80</strong> inside the pod. You should check the pod state:</p>
<pre><code>kubectl get pods
</code></pre>
<p>It will also tell you which port(s) the pod (its containers) is listening to. </p>
<p>Maybe it has crashed. Also check the log of th... | HefferWolf |
<p>I have a running cluster on Google Cloud Kubernetes engine and I want to access that using kubectl from my local system.</p>
<p>I tried installing kubectl with gcloud but it didn't worked. Then I installed kubectl using apt-get. When I try to see the version of it using kubectl version it says</p>
<p>Unable to con... | tank | <p><code>gcloud container clusters get-credentials ...</code> will auth you against the cluster using your gcloud credentials.</p>
<p>If successful, the command adds appropriate configuration to <code>~/.kube/config</code> such that you can <code>kubectl</code>.</p>
| DazWilkin |
<p>I'm trying to implement python script which collect and parsing kubernetes pod manifest's image version and secretName of each pod in 2 various kubernetes clusters and then if there are any differences between 2 clusters - should be send an alert. These metrics for 2 clusters then should be parsed by instance of Vic... | Garamoff | <p>Here's an example.</p>
<p>I've includes comment references to the Python SDK's implementation of the Kubernetes types as well as the type hints for these types to help explain the use of the properties.</p>
<p>I've included the full enumeration of <a href="https://github.com/kubernetes-client/python/blob/master/kube... | DazWilkin |
<p>Is there a way to make Kubernetes Pods aware of the new file changes ?</p>
<p>Lets say, I have an Kubernetes(K8) pod running with 4 replicas created, also I have an K8 PV created and attached to the external file system where we can modify the files. Lets consider K8 pod is running
a tomcat server with an applicatio... | babs84 | <p>If you are referring to file changes meaning changes to your application, the best practice is to bake a container image with your application code, and push a new container image when you need to deploy new code. You can do this by modifying your Kubernetes deployment to point to the latest digest hash.</p>
<p>For ... | Alex Watt |
<p>I've been following <a href="https://www.youtube.com/watch?v=DwlIn9zOcfc" rel="nofollow noreferrer">tutorial videos</a> and trying to understand to build a small minimalistic application. The videos I followed are pulling containers from the registries while I'm trying to test, build and deploy everything locally at... | AppDeveloper | <p>The snippets you provide are regrettably insufficient but you have the basics.</p>
<p>I had a Google for you for a tutorial and -- unfortunately -- nothing obvious jumped out. That doesn't mean that there isn't one, just that I didn't find it.</p>
<p>You've got the right idea and there are quite a few levels of tech... | DazWilkin |
<p>In case of cloud managed kubernetes, whether AWS EKS, Azure AKS or Google GKE, the option to use customer managed key always comes at the cost of storing the customer master key in the cloud provider's own vault/KMS (e.g. aws kms or azure vault). In this case the cloud provider still has access to customer encryptio... | devcloud | <p>You could use a 3rd party kubernetes storage provider like portworx that will take you across clusters and keep data encrypted.
<a href="https://docs.portworx.com/portworx-install-with-kubernetes/storage-operations/create-pvcs/create-encrypted-pvcs/" rel="nofollow noreferrer">https://docs.portworx.com/portworx-insta... | Illusionist |
<p>i've a question i create my config map but i dont know how to apply them to k8s ?
if i execute the command </p>
<pre><code>kubectl get configmap configmap-cas-properties -o yaml
</code></pre>
<p>i can see my configmap. However i cant find any information on how to add it to k8s . </p>
<p>I going to use it with my... | morla | <p>The ConfigMaps can be set as Environment variables which can be read in the application. Another way is to mount the ConfigMaps as a Volume in the Container and the application read the data from there. <a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/" rel="nofollow noreferr... | Praveen Sripati |
<p>Just for training purpose, I'm trying to inject those env variables with this ConfigMap in my Wordpress and Mysql app by using a File with a Volume.</p>
<pre class="lang-yaml prettyprint-override"><code>---
apiVersion: v1
kind: ConfigMap
metadata:
name: wordpress-mysql
namespace: ex2
data:
wordpress.conf: |
... | Kevin | <p>@DavidMaze is correct; you're mixing two useful features.</p>
<p>Using <code>test.yaml</code>:</p>
<pre><code>---
apiVersion: v1
kind: ConfigMap
metadata:
name: wordpress-mysql
data:
wordpress.conf: |
WORDPRESS_DB_HOST mysql
WORDPRESS_DB_USER admin
WORDPRESS_DB_PASSWORD "1234"
WORDPRESS... | DazWilkin |
<p>I have many pods in a kubernetes system with randomly name wordpress.xxx.xx.</p>
<p>Here the list of <a href="https://i.stack.imgur.com/k7Jxw.png" rel="nofollow noreferrer">pods</a></p>
<p>I want to use one command with <code>kubectl cp</code> in other to copy files to all pods from one deployment.</p>
<p>In my c... | Ngo Quyet | <p>The <code>kubectl cp</code> command copies files to a single container in a pod. To copy files in multiple containers easily, the below shell script can be used.</p>
<pre><code>for pod in `kubectl get pods -o=name | grep wordpress | sed "s/^.\{4\}//"`; do echo "copying to $pod"; kubectl cp file.txt $pod:/; done
</c... | Praveen Sripati |
<p>I'm trying to run the open source cachet status page within Kubernetes via this tutorial <a href="https://medium.com/@ctbeke/setting-up-cachet-on-google-cloud-817e62916d48" rel="nofollow noreferrer">https://medium.com/@ctbeke/setting-up-cachet-on-google-cloud-817e62916d48</a> </p>
<p>2 docker containers (cachet/ngi... | JJ Nace | <p>Yes, you need to generate a key.</p>
<p>In the <code>entrypoint.sh</code> you can see that the bash script generates a key for you:</p>
<p><a href="https://github.com/CachetHQ/Docker/blob/master/entrypoint.sh#L188-L193" rel="nofollow noreferrer">https://github.com/CachetHQ/Docker/blob/master/entrypoint.sh#L188-L19... | jaxxstorm |
<p>I have a certain processing task that I want to solve with kubernetes. The basic concept is that there is a certain number of items in a work queue that I want to process. Items can be added to the queue and are deleted as soon as a pod finished processing one.
The preferred work flow would be:</p>
<ul>
<li>Definin... | Fabian83 | <p>Use a <a href="https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/" rel="nofollow noreferrer">Horizontal Pod Autoscaler</a>. You may have to define Custom Metrics for getting the number of items in the Queue and use it in HPA.</p>
| Praveen Sripati |
<p>My requirement is to monitor the helpdesk system of the company which is running inside the Kubernetes cluster, for example, URL <a href="https://xyz.zendesk.com" rel="nofollow noreferrer">https://xyz.zendesk.com</a></p>
<p>They provide their <a href="https://developer.zendesk.com/api-reference/status_api/status_api... | vjwilson | <p>What you probably (!?) want is something that:</p>
<ol>
<li>Provides an HTTP(s) (e.g. <code>/metrics</code>) endpoint</li>
<li>Producing metrics in Prometheus' exposition format</li>
<li>From Zendesk's API</li>
</ol>
<blockquote>
<p><strong>NOTE</strong> <code>curl</code> only gives you #3</p>
</blockquote>
<p>There... | DazWilkin |
<p>I have installed the Edge version of Docker for Windows 18.05.0-ce (Windows 10 Hyper-V) and enabled Kubernetes afterwards.<br>
On my other machine a kubectl context was created automatically, but on this new machine it was not.</p>
<pre><code>> kubectl config get-contexts
CURRENT NAME CLUSTER AUTHINFO ... | KasperT | <p>There is an issue with docker for windows when the <code>HOMEDRIVE</code> is set by a corporate policy.</p>
<p>If you set the <code>$KUBECONFIG</code> environment variable to <code>C:\Users\my_username\.kube\config</code> (make sure the <code>$HOME</code> environment variables expand, don't use <code>$HOME</code> it... | jaxxstorm |
<p>I have a rabbitMQ in my project, and I want the queues on one pod to be on the other and the information on one pod to be shared with the other pod. Is there a way for you to share the same volume and both can read and write? I use GCloud.</p>
| Sermanes | <p>GCEPersistentDisk supports only ReadWriteOnce and ReadOnlyMany and not the ReadWriteMany access modes. So, it's not possible to share a volume across two containers in a RW mode. <a href="https://kubernetes.io/docs/concepts/storage/persistent-volumes/#access-modes" rel="nofollow noreferrer">Here</a> is the documenta... | Praveen Sripati |
<p>I made hadoop image based on centos using dockerfile. There are 4 nodes. I want to configure cluster using ssh-copy-id. But an error has occurred. </p>
<pre><code>ERROR: ssh: connect to host [ip] port 22: Connection refused
</code></pre>
<p>How can I solve this problem?</p>
| K.k | <p><code>ssh</code> follows a client-server architecture. So, the <code>openssh-server</code> has to be installed in the container. Now <code>ssh-copy-id</code> and other commands should run if the ip address is routable.</p>
| Praveen Sripati |
<p>how can I describe this command in yaml format?</p>
<pre><code>kubectl create configmap somename --from-file=./conf/nginx.conf
</code></pre>
<p>I'd expect to do something like the following yaml, but it doesn't work </p>
<pre><code>apiVersion: v1
kind: ConfigMap
metadata:
name: somename
namespace: default
fro... | Maoz Zadok | <p>That won't work, because kubernetes isn't aware of the local file's path. You can simulate it by doing something like this:</p>
<pre><code>kubectl create configmap --dry-run=client somename --from-file=./conf/nginx.conf --output yaml
</code></pre>
<p>The <code>--dry-run</code> flag will simply show your changes on s... | jaxxstorm |
<p>I am trying to fully purge my kube env, but sometimes when I run <code>helm delete --purge</code> some pods don't delete (sometimes).
<br>
<br>
Is there any issues using <code>kubectl delete pods --grace-period=0 --force</code>
Or will using this command over and over lead to any issues on my cluster or nodes? </p>... | user3292394 | <p>According to the K8S documentation <a href="https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#delete" rel="nofollow noreferrer">here</a>. Depending on the application it might lead to corruption or inconsistency of the data because of the duplication of the pods till the node detects and kills ... | Praveen Sripati |
<p>I have set up a Kubernetes cluster using Kubernetes Engine on GCP to work on some data preprocessing and modelling using Dask. I installed Dask using Helm <a href="http://docs.dask.org/en/latest/setup/kubernetes-helm.html" rel="nofollow noreferrer">following these instructions</a>.</p>
<p>Right now, I see that ther... | PollPenn | <blockquote>
<p>What are the suggested workflow to follow when working on a cluster? </p>
</blockquote>
<p>There are many workflows that work well for different groups. There is no single blessed workflow.</p>
<blockquote>
<p>Should I just create a new notebook under work and begin prototyping my data preprocess... | MRocklin |
<p>We are trying to build a Kubernetes node on our Private VMware infrastructure. I have the cluster up and running and and ingress running, however I can't figure out how to route traffic to the ingress.</p>
<p>We are using Rancher 2.0.7. </p>
<p><strong>I would like to have the following s... | Gneisler | <p>You need to be able to set the Ingress Service to <code>type=LoadBalancer</code>. With on-prem infrastructure, this either requires you to have an external loadbalancer like an <a href="https://clouddocs.f5.com/products/connectors/k8s-bigip-ctlr/v1.0/" rel="nofollow noreferrer">F5</a>.</p>
<p>One option to have thi... | jaxxstorm |
<p>I'm trying to add a custom function In Go template for parsing the time in PodStatus and getting the absolute time for it.</p>
<p>Example for the custom function:</p>
<pre><code>PodScheduled, _ := time.Parse(time.RFC3339, "2021-12- 23T20:20:36Z")
Ready, _ := time.Parse(time.RFC3339, "2021-12-31T07:36:... | Zipzap | <p>IIUC you have (at least) 3 options:</p>
<ol>
<li>Discouraged: Write your own client (instead of <code>kubectl</code>) that provides the functionality;</li>
<li>Encouraged: Use the shell to post-process the output from e.g. <code>kubectl get pods --output=json</code>) by piping the result through:
<ul>
<li>Either you... | DazWilkin |
<p>Somebody knows what source code and version were used to create docker image gcr.io/google_containers/kube2sky:<strong>1.15</strong>?</p>
<p>The latest version where I could find kube2sky in kubernetes repository is the branch release-1.2 in folder: <a href="https://github.com/kubernetes/kubernetes/tree/release-1.2... | Claudio Saavedra | <p>kube2sky is pretty old. It used to be stored in the kubernetes main repo, but was removed quite a while back.</p>
<p>You can find it here: <a href="https://github.com/kubernetes/kubernetes/tree/1c8140c2ac1fb7cb6ddbadc5e1efb3c0beefb8df/cluster/addons/dns/kube2sky" rel="nofollow noreferrer">https://github.com/kuberne... | jaxxstorm |
<p>Because Kubernetes handles situations where there's a typo in the job spec, and therefore a container image can't be found, by leaving the job in a running state forever, I've got a process that monitors job events to detect cases like this and deletes the job when one occurs.</p>
<p>I'd prefer to just stop the job... | Brent212 | <p>1) According to the K8S documentation <a href="https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/" rel="nofollow noreferrer">here</a>.</p>
<blockquote>
<p>Finished Jobs are usually no longer needed in the system. Keeping them around in the system will put pressure on the API server.... | Praveen Sripati |
<p>To make ingress work <a href="https://medium.com/google-cloud/understanding-kubernetes-networking-ingress-1bc341c84078" rel="nofollow noreferrer">as far as I understand it</a> you need to create all services (that are using ingress controllers) as type NodePort.</p>
<p>Therefore is 2768 the service limit for ingres... | Compendius | <p>You're understanding isn't necessarily correct.</p>
<p>It depends on your environment, cloud provider, ingress controller etc. Because the ingress controller is provisioned inside the cluster, all services that requires an ingress can use ClusterIP, and the ingress controller will route traffic to it.</p>
<p>Again... | jaxxstorm |
<p>When working on a local project, <code>from local_project.funcs import local_func</code> will fail in the cluster because <code>local_project</code> is not installed.</p>
<p>This forces me to develop everything on the same file.</p>
<p>Solutions? Is there a way to "import" the contents of the module into the worki... | Nuno Silva | <p>Typically the solution to this is to make your own docker image. If you have only a single file, or an egg or zip file then you might also look into the <code>Client.upload_file</code> method</p>
| MRocklin |
<p>I am trying to add a new key value pair to existing set of Annotations to a running Pod using the below example code:</p>
<pre><code>import (
"fmt"
"context"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/tools/clientcmd"
... | Niranjan M.R | <p>You're going to want something along the lines:</p>
<pre class="lang-golang prettyprint-override"><code>...
pod.SetAnnotations(annotations)
client.
CoreV1().
Pods("default").
Update(context.TODO(), pod, metav1.UpdateOptions{})
</code></pre>
<p>See: <a href="https://pkg.go.dev/k8s.io/client-go@v0.23.1... | DazWilkin |
<p>I want to expose my kubernetes cluster with minikube. </p>
<p>consider my tree</p>
<pre><code>.
├── deployment.yaml ... | A.Dumas | <p>According to the K8S documentation <a href="https://kubernetes.io/docs/concepts/services-networking/#loadbalancer" rel="noreferrer">here</a>. So, <code>type=LoadBalancer</code> can be used on AWS, GCP and other supported Clouds, not on Minikube.</p>
<blockquote>
<p>On cloud providers which support external load b... | Praveen Sripati |
<p>We currently have 2 Kubernetes clusters:</p>
<ul>
<li><p>One setup with Kops running on AWS</p></li>
<li><p>One setup with Kubeadm running on our own hardware</p></li>
</ul>
<p>We want to combine them to only have a single cluster to manage. </p>
<p>The master could end up being on AWS or on our servers, both are... | MasterScrat | <p>You can join the nodes manually, but this is really not a recommend way of doing things.</p>
<p>If you're using kubeadm, you probably already have all the relevant components installed on the workers to have them join in a valid way. What I'd say the process to follow is:</p>
<p>run <code>kubeadm reset</code> on t... | jaxxstorm |
<p>Several weeks ago I asked <a href="https://stackoverflow.com/questions/71224960/commands-to-switch-kubectl-and-gcloud-back-and-forth-between-two-totally-separat">this question</a> and received a very helpful answer. The gist of that question was: "<em>how do I switch back and forth between two different K8s/GCP... | simplezarg | <p>I'll assume familiarity with the earlier <a href="https://stackoverflow.com/a/71225494/609290">answer</a></p>
<h3><code>gcloud</code></h3>
<p><a href="https://cloud.google.com/sdk/gcloud/reference/init" rel="nofollow noreferrer"><code>gcloud init</code></a> need only be run once per machine and only again if you rea... | DazWilkin |
<p>I'm trying to write a k8s controller. Within the controller I want to parse the YAML file from GitHub to <code>unstructured. Unstructured</code>. After parsing, I want to track the status of the applied instance of <code>unstructured. Unstructured</code>. The tracking will try to catch if there's a specific key-valu... | Ian Zhang | <p>The unstructured package provides "Nested" functions.
<a href="https://godoc.org/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" rel="nofollow noreferrer">https://godoc.org/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured</a></p>
<p>For status you would use:</p>
<pre><code>unstructured.NestedStringMap(... | user620143 |
<p>I created a pod with <code>kubectl create -f pod.xml</code> and <code>kubectl apply -f pod.xml</code> using the below yaml and I don't see any difference, a pod gets created with both the commands. The <a href="https://kubernetes.io/docs/concepts/overview/object-management-kubectl/overview/" rel="noreferrer">K8S doc... | Praveen Sripati | <p>There is a subtle difference between <code>kubectl create</code> and <code>kubectl apply</code> commands.</p>
<p>The <code>kubectl create</code> command creates a new resource. So, if the command is run again it will throw an error as resource names should be unique in a namespace.</p>
<pre><code>kubectl get pods
... | Praveen Sripati |
<p>I want to start Kubernetes jobs on a GKE cluster from a Google Cloud Function (Firebase)</p>
<p>I'm using the Kubernetes node client <a href="https://github.com/kubernetes-client/javascript" rel="nofollow noreferrer">https://github.com/kubernetes-client/javascript</a></p>
<p>I've created a Kubernetes config file usi... | patrick_corrigan | <p>I have a similar mechanism (using Cloud Functions to authenticate to Kubernetes Engine) albeit written in Go.</p>
<p>This approach uses Google's <a href="https://cloud.google.com/kubernetes-engine/docs/reference/rest" rel="nofollow noreferrer">Kubernetes Engine API</a> to get the cluster's credentials and construct ... | DazWilkin |
<p>I want to deploy a few <code>Spring Boot</code> microservices on <code>Kubernetes</code> cluster. One of them is <em>authorization server</em> serving <code>OAuth 2.0</code> tokens. With current deployment (no k8s) only two services are visible to the outer world: <code>api-gateway</code> (Zuul) and <code>authorizat... | k13i | <p>Getting rid of Zuul is perfectly reasonable. Ingress should be the only outer-cluster accessible component that provides access to the cluster through ingress rules.
So yes, authorization-server and microservices should be accessible through ingress.</p>
| Jeff |
<p>I am new to Kubernetes and looking for a better understanding of the difference between Kube-DNS and CoreDNS.</p>
<p>As I understand it the recommendation is to use the newer CoreDNS rather than the older Kube-DNS. </p>
<p>I have setup a small cluster using <code>kubeadm</code> and now I am a little confused about... | lanoxx | <p>I have K8S 1.12. Do a describe of the dns pod.</p>
<blockquote>
<p>kubectl describe pod coredns-576cbf47c7-hhjrs --namespace=kube-system | grep -i "image:"</p>
<p>Image: k8s.gcr.io/coredns:1.2.2</p>
</blockquote>
<p>Looks like coredns is running. According to the documentation CoreDNS is default fr... | Praveen Sripati |
<p>Currently I am working on a project where we have a single trusted master server, and multiple untrusted (physically in an unsecured location) hosts (which are all replicas of each other in different physical locations).</p>
<p>We are using Ansible to automate the setup and configuration management however I am ver... | kittydoor | <p>There's a little bit of a lack of info here. I'm going to make the following assumptions:</p>
<ul>
<li>K8s nodes are untrusted</li>
<li>K8s masters are trusted</li>
<li>K8s nodes <em>cannot</em> communicate with each other</li>
<li>Containers on the same host <em>can</em> communicate with each other</li>
</ul>
<p>... | jaxxstorm |
<p>I am currently getting my kubeconfig files for my GKE clusters via</p>
<pre><code>export KUBECONFIG=<config-path>
gcloud container clusters get-credentials cluster-name --region=region-name
</code></pre>
<p>Now I get the config files and I can use them.</p>
<p>However, for some applications it would be helpful... | tobias | <p>See Google's post <a href="https://cloud.google.com/blog/products/containers-kubernetes/kubectl-auth-changes-in-gke" rel="nofollow noreferrer"><code>kubectl</code> auth changes in GKE v1.25</a> for changes to the way that <code>KUBECONFIG</code> files will authenticate to GKE clusters. Your <code>KUBECONFIG</code> u... | DazWilkin |
<p>The failing code runs inside a Docker container based on <code>python:3.6-stretch</code> debian.
It happens while Django moves a file from one Docker volume to another.</p>
<p>When I test on MacOS 10, it works without error. Here, the Docker containers are started with docker-compose and use regular Docker volumes ... | Risadinha | <p>The following solution is a hotfix. It would have to be applied to <em>any</em> method that calls <code>copystat</code> directly or indirectly (or any shutil method that produces an ignorable <code>errno.ENOSYS</code>).</p>
<pre><code>if hasattr(os, 'listxattr'):
LOGGER.warning('patching listxattr to avoid ERRO... | Risadinha |
<p>I'm trying to understand the relationship among Kubernetes pods and the cores and memory of my cluster nodes when using Dask.</p>
<p>My current setup is as follows:</p>
<ul>
<li>Kubernetes cluster using GCP's Kubernetes Engine</li>
<li>Helm package manager to install Dask on the cluster</li>
</ul>
<p>Each node ha... | PollPenn | <p>If you don't specify a number of cores or memory then every Dask worker tries to take up the entire machine on which it is running.</p>
<p>For the helm package you can specify the number of cores and amount of memory per worker by adding resource limits to your worker pod specification. These are listed in the con... | MRocklin |
<p>I am trying to use <code>if/else-if/else</code> loop in helm chart. Basically, I want to add ENV configs in configfile based on the if/else condition. Below is the logic:</p>
<pre><code>apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Values.applicationName }}-configmap
labels:
projectName: {{ .Values.appl... | dharmendra kariya | <p>Your question would benefit from more specifics.</p>
<p>Please consider adding the following to your question:</p>
<ul>
<li>How are you trying this? What commands exactly did you run?</li>
<li>How are you "not getting the desired output"? What output did you get?</li>
</ul>
<p>Please also include:</p>
<ul>... | DazWilkin |
<p>I have a scenario and was wondering the best way to structure it with Kustomize.</p>
<p>Say I have multiple environments: <code>dev</code>, <code>qa</code>, <code>prod</code></p>
<p>and say I have multiple DCs: <code>OnPrem</code>, <code>AWS</code>, <code>GCP</code></p>
<p>Let's say each DC above has a <code>dev</co... | CodyK | <p>I recommend having an overlay for each combination you want to build. e.g:</p>
<pre><code>└── overlays
├── aws-dev
├── aws-qa
└── gcp-dev
</code></pre>
<p>Then you can structure in different ways, such as using components:</p>
<pre><code>└── components
├── environments
│ ├── dev
│ └── qa
... | Martín Coll |
<p>We have a Rancher Kubernetes cluster where sometimes the pods get stuck in <code>terminating</code> status when we try to delete the corresponding deployment, as shown below.</p>
<pre><code>$ kubectl get deployments
NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
...
storage-manag... | gruggie | <p>Check the pod spec for an array: 'finalizers'</p>
<pre><code>finalizers:
- cattle-system
</code></pre>
<p>If this exists, remove it, and the pod will terminate.</p>
| jaxxstorm |
<p>I am starting the implementation in the project where I work, but I had some doubts.</p>
<ol>
<li><p>I have a project with several profiles spring, and for each I may want to have a replicated amount.</p>
<p>Example:</p>
<ul>
<li>Dev and staging (1 replica)</li>
<li>Production (3 replicas)</li>
</ul>
<p>How shou... | Rafael Dani da Cunha | <p>You should store them with your code in a build folder. If you are deploying on multiple platforms (AKS, EKS, GKE, OpenShift..) you could create a subfolder for each. </p>
<p>The amount of environment specific configuration should be kept to a bare minimum.
So I would recommend using some templating for the files i... | Jeff |
<p>Has anyone tried to add or update the Clusters from Google Kubernetes Engine through Python API?</p>
<p>I managed to do this for Compute instances, but the guide for Kubernetes Engine says its deprecated:</p>
<p><a href="https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1/projects.zones.clusters.nodePo... | happymatei | <p>I've <strike>not</strike> now tried this.</p>
<p>But IIUC, you'll need to:</p>
<ul>
<li><strike>ditch (or use defaults) for e.g. <code>project_id</code>, <code>zone</code> and <code>cluster_id</code> parameters of <code>resourceLabels</code></strike></li>
<li>add <code>name</code> to your body and it should be of th... | DazWilkin |
<p>Unable to configure Locality-prioritized load balancing.
There are two nodes with the labels:</p>
<pre><code> labels:
kubernetes.io/hostname: test-hw1
topology.kubernetes.io/region: us
topology.kubernetes.io/zone: wdc04
</code></pre>
<pre><code> labels:
kubernetes.io/hostname: test-hw2
topology... | Jonas | <p>Turns out that the issue was in the NodePort service that was accepting traffic from outside. Services by default are load-balancing traffic across the pods, so sometimes connections were routed to the other region <code>istio-ingressgateway</code> pod.
Simply adding <code>externalTrafficPolicy: Local</code> to the ... | Jonas |
<p>I recently learned about <code>helm</code> and how easy it is to deploy the whole <code>prometheus</code> stack for monitoring a Kubernetes cluster, so I decided to try it out on a staging cluster at my work.</p>
<p>I started by creating a dedicates namespace on the cluster for monitoring with:</p>
<pre class="lang-... | everspader | <p>The Prometheus Operator includes several Custom Resource Definitions (CRDs) including <code>ServiceMonitor</code> (and <code>PodMonitor</code>). <code>ServiceMonitor</code>'s are used to define services to the Operator to be monitored.</p>
<p>I'm familiar with the Operator although not the Helm deployment but I susp... | DazWilkin |
<p>This EKS cluster has a private endpoint only. My end goal is to deploy Helm charts on the EKS. I connect to an EC2 machine via SSM and I have already installed Helm and Kubectl on that machine. The trouble is that in a private network, the AWS APIs can't be called. So, instead of calling <strong>aws eks update-kubec... | Morariu | <p>That looks like this open EKS issue: <a href="https://github.com/aws/containers-roadmap/issues/298" rel="nofollow noreferrer">https://github.com/aws/containers-roadmap/issues/298</a></p>
<p>If that’s the case, upvote it so that the product team can prioritize it. If you have Enterprise support your TAM can help th... | Corey Cole |
<p>I have a k8s service of type clusterIP.. i need to change the below configuration via CLI</p>
<ol>
<li>the http port to https port</li>
<li>the port number</li>
<li>the type to Load Balancer</li>
</ol>
<p>Is there a way to do it..?</p>
| Ram | <p>You can't remove the existing port, but you <em>can</em> add the HTTPs port and also change the type using <a href="https://kubernetes.io/docs/tasks/run-application/update-api-object-kubectl-patch/" rel="noreferrer">kubectl patch</a></p>
<p>Example:</p>
<pre><code>kubectl patch svc <my_service> -p '{"spec": ... | jaxxstorm |
<p>I wish to run k6 in a container with some simple javascript load from local file system,
It seems the below had some syntax error</p>
<pre><code>$ cat simple.js
import http from 'k6/http';
import { sleep } from 'k6';
export const options = {
vus: 10,
duration: '30s',
};
export default function () {
http.get('h... | sqr | <p>I think you can't pipe (host) files into Kubernetes containers this way.</p>
<p>One way that it should work is to:</p>
<ol>
<li>Create a ConfigMap to represent your file</li>
<li>Apply a Pod config that mounts the ConfigMap file</li>
</ol>
<pre class="lang-bash prettyprint-override"><code>NAMESPACE="..." #... | DazWilkin |
<p>I need to restrict pod egress traffic to external destinations. Pod should be able to access any destination on the internet and all cluster internal destinations should be denied.</p>
<p>This is what I tried and it is not passing validation:</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: networki... | Jonas | <p>I did it using <code>NetworkPolicy</code>. Allow traffic to kubernetes and istio related services (could be more restrictive not just based on the namespace):</p>
<pre><code>apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: myapp-eg-system
spec:
podSelector:
matchLabels:
app: myapp
... | Jonas |
<p>What is a Load Balancer? </p>
<blockquote>
<p>Load balancing improves the distribution of workloads across multiple
computing resources, such as computers, a computer cluster, network
links, central processing units, or disk drives</p>
</blockquote>
<h3>The NodePort</h3>
<p>NodePort is not load balancer. (... | Veerendra K | <blockquote>
<p>NodePort is not load balancer. </p>
</blockquote>
<p>You're right about this in one way, yes it's not designed to be a load balancer.</p>
<blockquote>
<p>users still hits a single node i.e. the "Node" which is K8s's minion but a real Load Balancer, right?</p>
</blockquote>
<p>With NodePort, you <... | jaxxstorm |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.