kubernetes-up-and-running / examples Goto Github PK
View Code? Open in Web Editor NEWExample code and files from "Kubernetes: Up and Running"
License: Apache License 2.0
Example code and files from "Kubernetes: Up and Running"
License: Apache License 2.0
Originally the Healthrequests are instructed to go to:
httpGet:
path: /healthy
port: 8080
While the failures are generated on http://localhost:8080/ready and http://localhost:8080/healthy would always return http 200. No restart will be happening.
yaml file should be changed to
httpGet:
path: /ready
port: 8080
When trying to deploy the 5-1 example yaml:
$ kubectl apply -f kuard-pod.yaml
error: error validating "kuard-pod.yaml": error validating data: ValidationError(Pod.metadata): unknown field "spec" in io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta; if you choose to ignore these errors, turn validation off with --validate=false
$ kubectl version
Client Version: version.Info{Major:"1", Minor:"9", GitVersion:"v1.9.0", GitCommit:"925c127ec6b946659ad0fd596fa959be43f0cc05", GitTreeState:"clean", BuildDate:"2017-12-15T21:07:38Z", GoVersion:"go1.9.2", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"8", GitVersion:"v1.8.0", GitCommit:"0b9efaeb34a2fc51ff8e4d34ad9bc6375459c4a4", GitTreeState:"clean", BuildDate:"2017-11-29T22:43:34Z", GoVersion:"go1.9.1", Compiler:"gc", Platform:"linux/amd64"}
Update: Example 5-2 worked ok.
Also updated error message to correct one
-jjd
Why does examples start from chapter when examples are available starting from chapter 2 in the book? And why are examples separate from guard repository anyway? The book has a chaotic structure and so the examples. It takes a while to get an overview and what to do first.
Hey! When I run this command from the book for example 14-3:
kubectl apply cm --from-file ghost-config.js ghost-config
I get this error:
Error: unknown flag: --from-file
I'm on kubectl version:
Client Version: version.Info{Major:"1", Minor:"8", GitVersion:"v1.8.3", GitCommit:"f0efb3cb883751c5ffdbe6d515f3cb4fbe7b7acd", GitTreeState:"clean", BuildDate:"2017-11-08T18:39:33Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"6", GitVersion:"v1.6.4", GitCommit:"d6f433224538d4f9ca2f7ae19b252e6fcb66a3ae", GitTreeState:"dirty", BuildDate:"2017-06-22T04:31:09Z", GoVersion:"go1.7.5", Compiler:"gc", Platform:"linux/amd64"}
Do I need to be on an older version for that invocation to work?
For anyone else with this problem, I used this command to get it working:
kubectl create configmap ghost-config --from-file ghost-config.js
Hello,
Pods are setup on my GCP cluster but sentinel returns an error and replication between nodes is not ok.
If I try to determine which server the Redis sentinel believes is the master, I get the following :
$ kubectl exec redis-2 -c redis -- redis-cli -p 26379 sentinel get-master-addr-by-name redis
Could not connect to Redis at 127.0.0.1:26379: Connection refused
If I check sentinel logs
$ kubectl logs statefulsets/redis sentinel
Waiting for server
ping: bad address 'redis-0.redis'
And if I set foo 10 on redis-0 I don't get key on redis-2
Why I get bad address ?
What can I do ?
Thank you
I have the following conf saved in kuard-prod-health.yaml
apiVersion: v1
kind: Pod
metadata:
name: kuard
spec:
containers:
- image: gcr.io/kuar-demo/kuard-amd64:1
name: kuard
livenessProbe:
httpGet:
path: /healthy
port: 8080
initialDelaySeconds: 5
timeoutSeconds: 1
periodSeconds: 10
failureThreshold: 3
ports:
- containerPort: 8080
name: http
protocol: TCP
However when I try to apply the conf:
kubectl apply -f kuard-prod-health.yaml
I get this error:
The Pod "kuard" is invalid: spec: Forbidden: pod updates may not change fields other than
spec.containers[*].image
,spec.initContainers[*].image
,spec.activeDeadlineSeconds
orspec.tolerations
(only additions to existing tolerations)
hi guys
I have book 3rd edition will these examples work? they say last update 5 years ago
of there is a more recent repo?
thanks
Hello,
Thank you for the book, great help.
I try to use the Redis configuration on my prod on GCP but following the steps, I get the following error :
Error from server (BadRequest): a container name must be specified for pod redis-0, choose one of: [redis sentinel]
My configuration is the same present in the book
https://github.com/kubernetes-up-and-running/examples/blob/master/14-10-redis.yaml
apiVersion: apps/v1beta1
kind: StatefulSet
metadata:
name: redis
spec:
replicas: 3
serviceName: redis
template:
metadata:
labels:
app: redis
spec:
containers:
- command: [sh, -c, source /redis-config/init.sh ]
image: redis:3.2.7-alpine
name: redis
ports:
- containerPort: 6379
name: redis
volumeMounts:
- mountPath: /redis-config
name: config
- mountPath: /redis-data
name: data
- command: [sh, -c, source /redis-config/sentinel.sh]
image: redis:3.2.7-alpine
name: sentinel
volumeMounts:
- mountPath: /redis-config
name: config
volumes:
- configMap:
defaultMode: 420
name: redis-config
name: config
- emptyDir:
name: data
For example :
po/redis-0 1/2 CrashLoopBackOff 4 2m
po/redis-1 1/2 CrashLoopBackOff 4 2m
Same error :
$ kubectl logs po/redis-1 -p
Error from server (BadRequest): a container name must be specified for pod redis-1, choose one of: [redis sentinel]
Thank you for your help,
Julien
kubectl create -f 13-2.yaml
13-2 yaml is writed as
kind: Service
apiVersion: v1
metadata:
name: external-ip-database
I get the error
The Service "external-ip-database" is invalid: spec.ports: Required value
Commands in chapter 8 rely on the depreciated replicas. This is several places throughout the book.
It was removed in 1.18.
https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG/CHANGELOG-1.18.md#deprecation-4
kubectl run be-default \
--image=gcr.io/kuar-demo/kuard-amd64:blue
--replicas=3
--port=8080
Flag --replicas has been deprecated, has no effect and will be removed in the future.
pod/be-default created
Trying to run the example 8-1-kuard-rs.yaml with kubectl v1.16.3 and minikube v.1.6.2 and getting validation error:
➜ kubernetes-up-and-running_examples git:(master) ✗ kubectl apply -f 8-1-kuard-rs.yaml
error: error validating "8-1-kuard-rs.yaml": error validating data: ValidationError(ReplicaSet.spec): missing required field "selector" in io.k8s.api.apps.v1.ReplicaSetSpec; if you choose to ignore these errors, turn validation off with --validate=false
➜ kubernetes-up-and-running_examples git:(master) ✗ kubectl apply -f 8-1-kuard-rs.yaml
The ReplicaSet "kuard" is invalid: spec.template.metadata.labels: Invalid value: map[string]string{"app":"kuard", "version":"2"}: `selector` does not match template `labels`
➜ kubernetes-up-and-running_examples git:(master) ✗ kubectl version
Client Version: version.Info{Major:"1", Minor:"16", GitVersion:"v1.16.3", GitCommit:"b3cbbae08ec52a7fc73d334838e18d17e8512749", GitTreeState:"clean", BuildDate:"2019-11-13T11:23:11Z", GoVersion:"go1.12.12", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"17", GitVersion:"v1.17.0", GitCommit:"70132b0f130acc0bed193d9ba59dd186f0e634cf", GitTreeState:"clean", BuildDate:"2019-12-07T21:12:17Z", GoVersion:"go1.13.4", Compiler:"gc", Platform:"linux/amd64"}
➜ kubernetes-up-and-running_examples git:(master) ✗ minikube version
minikube version: v1.6.2
commit: 54f28ac5d3a815d1196cd5d57d707439ee4bb392
When I run
kubectl apply -f examples/5-1-kuard-pod.yaml
I get this error:
error: error validating "examples/5-1-kuard-pod.yaml": error validating data: found invalid field spec for v1.ObjectMeta; if you choose to ignore these errors, turn validation off with --validate=false
And when I add --validate=false
and run:
kubectl apply -f examples/5-1-kuard-pod.yaml --validate=false
I get this error:
The Pod "kuard" is invalid: spec.containers: Required value
I am running K8S on Azure.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.