kubernates few clarifications on some topics

4/24/2020

I am new to k8s and i want to have few clarification on below questions, please let me know ur thoughts

  1. Does persistent volumes claims are confined to single namespace ?
  2. How many pod networks can we have per cluster ?
  3. Which namespace contains the infrastructure pods ?
  4. Does all objects are restricted to single namespace ?
  5. Does container offer a persistent storage that outlives the container ?
  6. What is the smallest object or unit(pod or container or replicaset or deployment) we can work with in k8s?
  7. does a deployment use a persistent volume or a persistent volume claim ?
  8. With deployment config spec which strategy(recreate or rollingupdate) allows us to control the updates to pod ?
  9. How can we start local proxy which is useful for development and testing ?
  10. Pod can have multiple ip address?
-- user2319726
kubernetes

2 Answers

4/24/2020
  1. A PersistentVolumeClaim (kubectl get pvc) is confined to a Namespace. A PersistentVolume (kubectl get pv) is defined on cluster-level. Each namespace can access the PV which are not "Bound"
  2. You have to install one CNI (Container Network Interface) like calico or flannel. There you will specify a PodNetworkCIDR e.q. 10.20.0.0/16. Then the IPAdressManagement of e.q. Calico will split that network into some smaller networks. Each Kubernetes Node get's his own Network from the 10.20.0.0/16 Network.
  3. If you mean the Kubernetes "Infrastructure" it's mostly deployed to kube-system. To deploy you're own stuff like Monitoring, Logging, Storage you can create your own Namespaces
  4. No not all Objects are bound to a Namespace. With kubectl api-resources you will get an overview.
  5. There are a lot of storagetype (https://kubernetes.io/docs/concepts/storage/volumes/#types-of-volumes). But if you not specify any volumes (PV) which are persistant, your files which are written in a container are gone if the container restarts.
  6. A Pod is the smallest Unit which can be addressed. A Pod could contain multiple container.
  7. A Deployment describes the state of the Pod. It's recommended to use a Deployment. You can start a Pod without a Deployment, but if you delete the Pod it will not be restarted by the Kubelet. (The following command creates a Pod without a Deployment: kubectl run nginx --image=nginx --port=80 --restart=Never). For Storage, you would specify the PVC in the Deployment. But you have to create that PVC before.(https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/)
  8. Exactly, For e.q. a MySQL you would use recreate, for httpd you would use rolling.
  9. What do you mean with local proxy For local development you can have a look at minikube?
  10. No, a Pod has only 1 IP.
-- CLNRMN
Source: StackOverflow

4/24/2020
  1. Does persistent volumes claims are confined to single namespace ?

Persistent Volume Claims(PVC) is bound to namespace. PVC must exist in the same namespace as the Pod using the claim

  1. How many pod networks can we have per cluster ?

Default maximum of 110 Pods per node, Kubernetes assigns a /24 CIDR block (256 addresses) to each of the nodes.

  1. Which namespace contains the infrastructure pods ?

Generally kube-system

  1. Does all objects are restricted to single namespace ?

No, not all objects are restricted to single namespace. You can create objects in different namespaces.

  1. Does container offer a persistent storage that outlives the container ?

If you use PV/PVC then your storage must be persistent

  1. What is the smallest object or unit(pod or container or replicaset or deployment) we can work with in k8s?

A Kubernetes pod is a group of containers, and is the smallest unit that Kubernetes administers.

  1. does a deployment use a persistent volume or a persistent volume claim ?

You need to use PVC in deployment, in volume section like following

volumes:
  - name: data
    persistentVolumeClaim:
      claimName: <pvc name>
  1. With deployment config spec which strategy(recreate or rollingupdate) allows us to control the updates to pod ?

Recreate will terminate all the running instances then recreate them with the newer version. Rolling update follows defined strategy of how many instance will be down and recreate at a time.

  1. How can we start local proxy which is useful for development and testing ?

You can use port-forwarding

  1. Pod can have multiple ip address?

single pod have single ip address. details here

-- hoque
Source: StackOverflow