Skip to content

Commit d3c0fad

Browse files
committed
Added more infomation on pod
Signed-off-by: knrt10 <[email protected]>
1 parent 4bd3096 commit d3c0fad

File tree

1 file changed

+33
-3
lines changed

1 file changed

+33
-3
lines changed

readme.md

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ This is just a simple demonstration to get a basic understanding of how kubernet
6262
- [Scheduling to one specific node](#scheduling-to-one-specific-node)
6363
- [Annotating pods](#Annotating-pods)
6464
- [Looking up an objects annotations](#looking-up-an-objects-annotations)
65+
- [Adding and modifying annotations](#adding-and-modifying-annotations)
66+
- [Using namespace to group resources](#using-namespace-to-group-resources)
6567

6668
4. [Todo](#todo)
6769

@@ -280,7 +282,7 @@ Now that you have your app packaged inside a container image and made available
280282

281283
Setting up a full-fledged, multi-node Kubernetes cluster isn’t a simple task, especially if you’re not well-versed in Linux and networking administration. A proper Kubernetes install spans multiple physical or virtual machines and requires the networking to be set up properly so that all the containers running inside the Kubernetes cluster can connect to each other through the same flat networking space.
282284

283-
#### Running a local single node Kubernetes cluster with Minikube
285+
### Running a local single node Kubernetes cluster with Minikube
284286

285287
The simplest and quickest path to a fully functioning Kubernetes cluster is by using Minikube. Minikube is a tool that sets up a single-node cluster that’s great for both testing Kubernetes and developing apps locally.
286288

@@ -692,11 +694,39 @@ A great use to annotating pods is to add desciption to each pod or other API obj
692694

693695
Let’s see an example of an annotation that Kubernetes added automatically to the pod you created in the previous section. To see the annotations, you’ll need to request the full YAML of the pod or use the `kubectl describe` command. You’ll use the first option in the following listing.
694696

695-
`kubectl get po kubia-zxzij -o yaml`
697+
`kubectl get po kubia-zb95q -o yaml`
696698
```bash
697-
699+
apiVersion: v1
700+
kind: Pod
701+
metadata:
702+
annotations:
703+
kubernetes.io/created-by: |
704+
{"kind":"SerializedReference", "apiVersion":"v1",
705+
"reference":{"kind":"ReplicationController", "namespace":"default", ...
698706
```
699707

708+
Without going into too many details, as you can see, the `kubernetes.io/created-by`
709+
annotation holds JSON data about the object that created the pod. That’s not something
710+
you’d want to put into a label. Labels should be **short**, whereas annotations can
711+
contain relatively large blobs of data **(up to 256 KB in total)**.
712+
713+
**Important**:- The kubernetes.io/created-by annotations was deprecated in version
714+
`1.8` and will be removed in `1.9`, so you will no longer see it in the YAML.
715+
716+
#### Adding and modifying annotations
717+
718+
Annotations can obviously be added to pods at creation time, the same way label can. But we can also add it after using the following command. Let's try adding this to `kubia-manual` pod now.
719+
720+
`kubectl annotate pod kubia-manual knrt10.github.io/someannotation="messi ronaldo"`
721+
722+
You added the annotation `knrt10.github.io/someannotation` with the value `messi ronaldo`. It’s a good idea to use this format for annotation keys to prevent key collisions. When different tools or libraries add annotations to objects, they may accidentally override each other’s annotations if they don’t use unique prefixes like you did here. You can check your pod now using following command
723+
724+
`kubectl describe po kubia-manual`
725+
726+
### Using namespace to group resources
727+
728+
Previously we saw how labels organize pods and objects into groups.
729+
700730
## Todo
701731

702732
- [ ] Write more about pods

0 commit comments

Comments
 (0)