kubectl

Create user group using RBAC API?

核能气质少年 提交于 2019-12-19 19:55:34
问题 I can't find documentation on how to create user group on Kubernetes with yaml file. I'd like gather some authenticated users in group using their e-mail accounts. I'd like to write in yaml something like : kind: GoupBinding apiVersion: rbac.authorization.k8s.io/v1beta1 metadata: name: "frontend-developers" namespace: development subjects: - kind: User name: a@xyz.com,vv@xyz.com apiGroup: "" 回答1: Groups are determined by the configured authentication method. See https://kubernetes.io/docs

'kubectl patch' works on Linux Bash but not in Windows Powershell ISE

随声附和 提交于 2019-12-17 20:30:38
问题 The following command works fine on Ubuntu bash: kubectl patch deployment wapi-backend-d1 --patch '{"spec": {"template": {"metadata": {"labels": {"date": "test"}}}}}' The same command does not work in Windows Powershell Console (ISE). The error is: kubectl : Error from server (BadRequest): invalid character 's' looking for beginning of object key string At line:1 char:1 + kubectl patch deployment wapi-backend-d1 --patch '{"spec": {"template ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Restart container within pod

ぐ巨炮叔叔 提交于 2019-12-17 15:34:09
问题 I have a pod test-1495806908-xn5jn with 2 containers. I'd like to restart one of them called container-test . Is it possible to restart a single container within a pod and how? If not, how do I restart the pod? The pod was created using a deployment.yaml with: kubectl create -f deployment.yaml 回答1: Is it possible to restart a single container Not through kubectl , although depending on the setup of your cluster you can "cheat" and docker kill the-sha-goes-here , which will cause kubelet to

User “system:anonymous” cannot get path “/”

假装没事ソ 提交于 2019-12-14 00:30:35
问题 I just setup a kubenetes cluster base on this link https://kubernetes.io/docs/setup/independent/create-cluster-kubeadm/#multi-platform I check with kubectl get nodes, then the master node is Ready, but when I access to the link https://k8s-master-ip:6443/ it show the error: User "system:anonymous" cannot get path "/". What is the trick I am missing ? 回答1: The latest kubernetes deployment tools enable RBAC on the cluster. Jenkins is relegated to the catch-all user system:anonymous when it

kubectl adding extra env variable to pod

荒凉一梦 提交于 2019-12-13 07:40:49
问题 Ok here is the story: I am using minikube to host my application: 1 pod running redis (redis on ubuntu:14.04) 1 pod running my php application (php7-apache) I realised that if I setup my redis pod first then my php pod, my php pod will have these extra env variables: REDIS_SERVICE_PORT=6379 REDIS_PORT_6379_TCP_ADDR=10.0.0.229 REDIS_PORT_6379_TCP_PORT=6379 REDIS_PORT_6379_TCP=tcp://10.0.0.229:6379 REDIS_PORT=tcp://10.0.0.229:6379 REDIS_SERVICE_HOST=10.0.0.229 These variables override the port

Istio RouteRule based on headers user-agent doesn't work

风流意气都作罢 提交于 2019-12-13 04:45:33
问题 I have two services running on minikube, Foo and Bar . When I'm accessing the Foo service it makes a request to Bar service to retrieve some data. Bar service have 2 versions "1.0" and "2.0" . I have setup the default RouteRule configuration with istio to route all the requests to "1.0" : apiVersion: config.istio.io/v1alpha2 kind: RouteRule metadata: name: bar-default spec: destination: name: bar-server precedence: 1 route: - labels: version: "1.0" It works fine, and I can see that all the

spring boot on azure Internal Server Error

旧城冷巷雨未停 提交于 2019-12-13 02:56:45
问题 I have a very simple "Hello" spring-boot application @RestController public class HelloWorld { @RequestMapping("/") public String sayHello() { return "Hello Spring Boot!!"; } } I packaged Dockerfile FROM java:8 COPY ./springsimple-1.0-SNAPSHOT.jar /Users/a/Documents/dev/intellij/dockerImages/ WORKDIR /Users/a/Documents/dev/intellij/dockerImages/ EXPOSE 8090 CMD ["java", "-jar", "springsimple-1.0-SNAPSHOT.jar"] and pulled into my container registry and deployed it amhg$ kubectl run testproject

How to get container's disk usage in Kubernetes (without docker command)?

China☆狼群 提交于 2019-12-12 18:34:32
问题 I have a Kubernetes Cluster and want to know how much disk space my containers use. I am not talking about mounted Volumes. I can get this information by using docker commands like docker system df -v or docker ps -s , but I don't want to connect to every single worker node. Is there a way to get a container's disk usage via kubectl or are there kubelet metrics where I can get this information from? 回答1: Yes, but currently not with kubectl, you can get metrics from the kubelet, either through

Kubernetes 0 Downtime using Readiness Probe and RollBack strategy not working

做~自己de王妃 提交于 2019-12-12 18:32:47
问题 I have set up a Node app on Kubernetes. I'm running a single replica and I want 0 down-time when the image is updated. I update my Pod using set Image on Kubernetes. 'set', 'image', 'deployment/dev-web' Here's my YAML file apiVersion: extensions/v1beta1 kind: Deployment metadata: annotations: deployment.kubernetes.io/revision: "2" generation: 2 labels: io.kompose.service: dev-web name: dev-web namespace: default spec: replicas: 1 selector: matchLabels: io.kompose.service: dev-web strategy:

How do I edit a resource configuration with kubectl?

情到浓时终转凉″ 提交于 2019-12-12 15:08:41
问题 I've created a resource with: kubectl create -f example.yaml How do I edit this resource with kubectl? Supposedly kubectl edit , but I'm not sure of the resource name, and kubectl edit example returns an error of: the server doesn't have a resource type "example" 回答1: You can do a kubectl edit -f example.yaml to edit it directly. Nevertheless I would recommend to edit the file locally and do a kubectl apply -f example.yaml , so it gets updated on Kubernetes. Also: Your command fails, because